You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
skeleton of a new StatelessWidget, good to use on construction
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class FancyButton extends StatelessWidget {
// let people click you
}
to give button a callback on press
final GestureTapCallback onPressed;
a constructor to inject callback
FancyButton(this.onPressed); // means constructor shall have a param matching property, handles assignment
FancyButton({@required this.onPressed}); // braces to make it optional named param, @required to make mandatory
override Widget build(BuildContext ctx) {...} to allow send custom children content
First Step Runnable Widget
current widget code
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class FancyButton extends StatelessWidget {
FancyButton({@required this.onPressed});
final GestureTapCallback onPressed;
@override
Widget build(BuildContext ctx) {
return Text("Click Me Now");
}
}