flutter-layout

How to encrypt the SQLite database in Flutter?

两盒软妹~` 提交于 2019-11-29 22:17:36
问题 I am creating a database in Flutter by the following code, is there any way we can encrypt the database? Is there any library available for Flutter? initDb() async { io.Directory documentsDirectory = await getApplicationDocumentsDirectory(); String path = join(documentsDirectory.path, "test.db"); var theDb = await openDatabase(path, version: 1, onCreate: _onCreate); return theDb; } 回答1: Pointy Castle seems to be the encryption library of choice at the moment. 回答2: Current sqflite uses

How to create a modal bottomsheet with circular corners in Flutter?

本秂侑毒 提交于 2019-11-29 17:17:34
问题 showModalBottomSheet does not provide any styling or decorations. I want to create something like the Google Tasks bottomsheet. 回答1: This is the modalBottomSheet function needed. void _modalBottomSheetMenu(){ showModalBottomSheet( context: context, builder: (builder){ return new Container( height: 350.0, color: Colors.transparent, //could change this to Color(0xFF737373), //so you don't have to change MaterialApp canvasColor child: new Container( decoration: new BoxDecoration( color: Colors

How to change status and navigation bar color in Flutter?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 09:18:28
I'm trying to change the color of system status bar to black. The configuration seems to be overridden by the AppBar class. I can achieve what I want by assigning theme: to ThemeData.dark() when creating the Material App, and then specifying an appBar attribute . But I don't want an AppBar, and also, doing it this way changes all the font colors. A possible solution is to inherit ThemeData.bright() into new class, then add something that only changes the system status bar through setSystemUIOverlayStyle And then I would need to specify AppBar and make it invisible somehow? https://docs.flutter

How to create a dynamic TabBarView/ Render a new Tab with a function in Flutter?

北慕城南 提交于 2019-11-29 04:58:39
So I have been learning flutter in a while and I am stuck in this. Sorry if it is a noobish question. I am currently trying to build something like a Card Tab. The information and widget will be stored in a card. Imagine something like Tinder, where they have multiple card stack and swipe left and right to navigate. I plan to create that but I cannot seems to find a way to add/render a new card with a button. It's like adding something to the list, Flutter will use a ListView builder where we add to the list. But there is no TabBarView builder. Is this something that is not possible to do? I

Flutter align two items on extremes - one on the left and one on the right

ε祈祈猫儿з 提交于 2019-11-29 04:40:33
问题 I am trying to align two items at extremes one on the left and one on the right. I have one row that is aligned to the left and then a child of that row is aligned to the right. However it seems the child row is picking up the alignment property from its parent. This is my code var SettingsRow = new Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.max, children: <Widget>[ Text("Right",softWrap: true,), ], ); var nameRow =

Builder versus GlobalKey

我的未来我决定 提交于 2019-11-29 02:20:32
Numerous questions relating to building Flutter UIs come down to the wrong BuildContext (such as showing a SnackBar ). The answers usually offer either of using a Builder or using a GlobalKey . Both work, but I noticed that the documentation for GlobalKey states: Global keys are relatively expensive. If you don't need any of the features listed above, consider using a Key , ValueKey , ObjectKey , or UniqueKey instead. The features referred to are unique identification and subtree re-parenting. Is the "relative expense" of using a GlobalKey for these circumstances reason enough to use a Builder

Button Width Match Parent : Flutter

爷,独闯天下 提交于 2019-11-28 19:27:59
问题 I am new in Flutter so 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 Expanded tag but Expanded expand view to both direction, i dont know how to do it. Help me if you

Flutter Layout Row / Column - share width, expand height

末鹿安然 提交于 2019-11-28 18:21:05
I'm still having a bit of trouble with the layouting in Flutter. Right now I want to have the available space shared between 3 widgets, in a quadrant layout. The width is evenly shared (this works fine via 2 Expanded widgets in a Row), but now I also want the height to adjust automatically so widget3.height == widget1.height + widget2.height . If the content of widget3 is larger, I want widget1 and widget2 to adjust their height and vice versa. Is this even possible in Flutter? Matt S. Have a look at IntrinsicHeight ; wrapping the root Row should provide the effect you're looking for: import

Bottom overflow by 30px

佐手、 提交于 2019-11-28 10:12:21
I face a problem by wrapping TextField with new Expanded() . When try to search something in textfield its show me bottom overflow by 30px . Below is my code: Widget build(BuildContext context) { return new Scaffold( body: Column( children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ IconButton(icon: Icon(Icons.search), onPressed: () { setState(() { }); }), new Flexible( child: new TextField( onChanged: (String value) { onchange(value); }, maxLines: 1, autocorrect: true, // decoration: const InputDecoration(helperText: "Search"), style: new TextStyle

Flutter Back button with return data

ぃ、小莉子 提交于 2019-11-28 01:00:12
I have an interface with two buttons that pop and return true or false, like so: onPressed: () => Navigator.pop(context, false) I need to adapt the back button in the appbar, so it pops and also returns false. Is there a way to accomplish this? This may help and work for you 1st screen void goToSecondScreen()async { var result = await Navigator.push(_context, new MaterialPageRoute( builder: (BuildContext context) => new SecondScreen(context), fullscreenDialog: true,) ); Scaffold.of(_context).showSnackBar(SnackBar(content: Text("$result"),duration: Duration(seconds: 3),)); } 2nd screen