How to make button width match parent?

I want to know that how can I set a width to match parent layout width new Container( width: 200.0, padding: const EdgeInsets.only(top: 16.0), child: new RaisedButton( child: new Text( “Submit”, style: new TextStyle( color: Colors.white, ) ), colorBrightness: Brightness.dark, onPressed: () { _loginAttempt(context); }, color: Colors.blue, ), ), I know about little bit on … Read more

Force Flutter navigator to reload state when popping

I have one StatefulWidget in Flutter with button, which navigates me to another StatefulWidget using Navigator.push(). On second widget I’m changing global state (some user preferences). When I get back from second widget to first, using Navigator.pop() the first widget is in old state, but I want to force it’s reload. Any idea how to … Read more

How to change the appBar back button color

I cannot figure out how to change the appBar’s automatic back button to a different color. it’s under a scaffold and I’ve tried to research it but I can’t wrap my head around it. return Scaffold( appBar: AppBar( backgroundColor: Colors.white, title: Image.asset( ‘images/.jpg’, fit: BoxFit.fill, ), centerTitle: true, ), 12 Answers 12

Check whether there is an Internet connection available on Flutter app

I have a network call to be executed. But before doing that I need to check whether the device have internet connectivity. This is what i have done so far: var connectivityResult = new Connectivity().checkConnectivity();// User defined class if (connectivityResult == ConnectivityResult.mobile || connectivityResult == ConnectivityResult.wifi) {*/ this.getData(); } else { neverSatisfied(); } Above method … Read more

How can I check if a Flutter application is running in debug?

I’m looking for a way to execute code in Flutter when the app is in Debug mode. Is that possible in Flutter? I can’t seem to find it anywhere in the documentation. Something like this If(app.inDebugMode) { print(“Print only in debug mode”); } How can I check if the Flutter application is running in debug … Read more

How to deactivate or override the Android “BACK” button, in Flutter?

Is there a way to deactivate the Android back button when on a specific page? class WakeUpApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: “Time To Wake Up ?”, home: new WakeUpHome(), routes: <String, WidgetBuilder>{ ‘/pageOne’: (BuildContext context) => new pageOne(), ‘/pageTwo’: (BuildContext context) => new pageTwo(), }, ); } … Read more