Posts

Showing posts with the label flutter-layout

Framelayout alternative in flutter

I want to add a Flutter Container in top of another Container and top container will be transparent. Basically I do that in native Android using FrameLayout. How to implement this in Flutter? Stack is most likely what you want. Stack allows to put widgets on the top of others however you like. And, combined with Positioned, have custom positions. Let's draw a real frame in flutter : Stack( alignment: Alignment.center, children: <Widget>[ Container( width: 200.0, height: 300.0, decoration: BoxDecoration( color: Colors.black12, border: Border.all( color: Colors.black, width: 3.0, ), ), ), Container( width: 100.0, height: 100.0, color: Colors.blue, ), Positioned( bottom: 10.0, right: 10.0, child: Card( child: Padding( padding: const EdgeInsets.all(8.0), child: Text("Title"), ), ), ) ], ),

Flutter error on closing navigator

Navigator operation requested with a context that does not include a Navigator full code is here class _MyAppState extends State<MyApp> { @override Widget build(BuildContext context) { return new MaterialApp( home: new Scaffold( drawer: new Drawer(child: new ListView( children: <Widget>[ new DrawerHeader( decoration:BoxDecoration( color: Colors.blue ), child: new Container( child: new Text("Hearer name"), ),), new ListTile( title: new Text("pop1"), onTap: (){Navigator.pop(context);}, ), new ListTile( title: new Text("pop2"), onTap: (){Navigator.pop(context);}, ), new Container( padding: const EdgeInsets.all(20.0), child:...

Dismissing AlertDialog in Flutter

I have simple Flutter app with list of items that are loaded from Firebase database (Cloud Firestore). As you can see - there is button for adding items and each item can be deleted or edited. When I press edit button for selected item, AlertDialog with TextField appears, in this TextField user can see current item name and edit it. I have problems only with dismissing dialog after editing. new IconButton( icon: new Icon(Icons.edit, color: Colors.white), onPressed: (){ showItemUpdateDialog(context, document); } ) ....... void showItemUpdateDialog(BuildContext context, DocumentSnapshot item) { String itemName = ""; var textContoller = new TextEditingController(); textContoller.text = item['name']; var dialog = new AlertDialog( title: new Text("item name"), content: new TextField( controller: textContoller, onChanged: (value) {newName = value;}, ), actions: <Widget>[ new FlatButton( ...