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

How to format DateTime in Flutter

I am trying to display the current DateTime in a Text widget after tapping on a button. The following works, but I’d like to change the format. Current approach DateTime now = DateTime.now(); currentTime = new DateTime(now.year, now.month, now.day, now.hour, now.minute); Text(‘$currentTime’), Result YYYY-MM-JJ HH-MM:00.000 Question How can I remove the :00.000 part? 15 Answers … Read more

setState() or markNeedsBuild called during build

class MyHome extends StatefulWidget { @override State<StatefulWidget> createState() => new MyHomePage2(); } class MyHomePage2 extends State<MyHome> { List items = new List(); buildlist(String s) { setState(() { print(“entered buildlist” + s); List refresh = new List(); if (s == ‘button0’) { refresh = [ new Refreshments(“Watermelon”, 250), new Refreshments(“Orange”, 275), new Refreshments(“Pine”, 300), new Refreshments(“Papaya”, … Read more

Flutter: upgrade the version code for play store

I have published an application on the play store with flutter, now I want to upload a new version of the application. I am trying to change the version code with: flutter build apk –build-name=1.0.2 –build-number=3 or changing the local.properties like this flutter.versionName=2.0.0 flutter.versionCode=2 flutter.buildMode=release but every time I get an error on the play … Read more

Visual Studio Code – Target of URI doesn’t exist ‘package:flutter/material.dart’

I’ve just set up my Macbook for flutter development, So I downloaded flutter SDK, and placed it in my Documents. After, I set up my path variable to work with flutter in my command line. I execute the command flutter create todolist so I achieve a blank project. I also set up my visual studio … Read more

When the keyboard appears, the Flutter widgets resize. How to prevent this?

I have a Column of Expanded widgets like this: return new Container( child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ new Expanded( flex: 1, child: convertFrom, ), new Expanded( flex: 1, child: convertTo, ), new Expanded( flex: 1, child: description, ), ], ), ); It looks like this: convertFrom, includes a TextField. When I tap on … Read more

Passing Data to a Stateful Widget in Flutter

I’m wondering what the recommended way of passing data to a stateful widget, while creating it, is. The two styles I’ve seen are: class ServerInfo extends StatefulWidget { Server _server; ServerInfo(Server server) { this._server = server; } @override State<StatefulWidget> createState() => new _ServerInfoState(_server); } class _ServerInfoState extends State<ServerInfo> { Server _server; _ServerInfoState(Server server) { this._server … Read more