Hi I’m trying to create button for my App using flutter but isn’t working I used
floatingActionButton: FloatingActionButton(
Child:Text('click'),
)
‘ this is the code that I used but still not working
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Waybill App'),
centerTitle: true,
),
body: Center(
child: Text('Welcome to Waybill Me'),
),
floatingActionButton: FloatingActionButton(
child: Text('click'),
),
),
),
),
));
}
2
Answers
You did not add
onPressed
argument to yourFloatingActionButton()
widget, which is required! try this:create a custom view widget like this :
and now you can easily pass your
CustomView
widget to wherever you want to use it; for instance, lets change your code to this :In your code please add onPressed. Like this