flutter-layout

How to implement a SliverAppBar with a collapsable search bar

六眼飞鱼酱① 提交于 2020-01-04 14:02:31
问题 This is what I'm trying to do, it's a pretty common Widget on iOS. This is my code: return Scaffold( backgroundColor: Colors.white, body: CustomScrollView( slivers: <Widget>[ SliverAppBar( automaticallyImplyLeading: false, pinned: true, titleSpacing: 0, backgroundColor: Colors.white, elevation: 1.0, title: Container( width: double.infinity, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisSize: MainAxisSize.max, children:

How to add a neon glow effect to an widget border / shadow?

孤者浪人 提交于 2020-01-04 04:56:08
问题 Is there any way to create effects like these using flutter (a CustomPaint with a special shadder or something like this)? For example. I have this container and I drew some lines on it using a CustomPainter. Could I draw these lines using a neon effect just like the pictures? The Paint class has a shader property that I thought I could set up to achieve this goal, but I don't realize how. Container( color: Colors.white, width: 300, height: 300, child: CustomPaint( painter: NeonPainter(), ),

Flutter Error: Could not find the correct ScopedModel

落花浮王杯 提交于 2020-01-03 15:34:06
问题 I am trying to create a scopedmodel in my flutter project and I can't seem to figure out why I get the error. What is wrong in this scopedmodel implementation? I have a home page with bottom navigator. Inside the profile tab, I fetch the list of followers which I need in a widget deep in the tree so I am trying to use scopedmodel. The model code is class RelationshipsModel extends Model { List<Relationship> relations; RelationshipsModel(this.relations); void add(String name) { relations.add

What is the difference between Material and MaterialApp in Flutter?

烂漫一生 提交于 2020-01-03 08:16:10
问题 I am developing an app using Flutter. If I choose MaterialApp as the parent widget of my app, all Text widgets in my app are underlined yellow. On the other hand, if I just use Material as the parent widget, no yellow lines are shown under the Text widgets. What is the difference between Material and MaterialApp ? 回答1: MaterialApp is a widget that introduces many interesting tools such as Navigator or Theme to help you develop your app. Material is, on the other hand, a widget used to define

Is it possible to pass AppBar from body in Scaffold widget?

喜夏-厌秋 提交于 2020-01-03 06:35:31
问题 I have a Scaffold widget with drawer . The screens I need to show in body have different AppBars (some of them have indicators for PageView , some of them are single paged, some have logo in it). So I do not pass any AppBar to my Scaffold but include it in widget I use in body . But there is no hamburger icon for drawer and it. Is it possible to pass this AppBar from my body widget to the Scaffold containing it? Or if there is a better way of widgets composition to solve this scenario I'd

Could not find a generator for route “home-page” in the _MaterialAppState

馋奶兔 提交于 2020-01-03 00:57:12
问题 I am getting exception when I trying to navigate from one view to another in flutter app. I/flutter ( 2199): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════ I/flutter ( 2199): The following assertion was thrown while handling a gesture: I/flutter ( 2199): Could not find a generator for route "home-page" in the _MaterialAppState. 回答1: Use Navigator.push(context, new MaterialPageRoute( builder: (context) => new MyHomePage()) ); Instead of

Flutter. A way for TextField to detect tap outside

♀尐吖头ヾ 提交于 2020-01-03 00:38:27
问题 Is there any way to detect a tap outside of TextTield? I wanna make a self sufficient search field component which should expend when focused and shrink when a focus is lost. The TextField is using FocusNode to unfocus itself when the focus is not needed but the problem is that I can't get the way to detect a tap outside of it. Wrapping the whole app in GestureDetector and requesting a new focus on tap is not an option at all because, first this tap can be easily intercepted by any component

Align Text widgets in a row widget

╄→尐↘猪︶ㄣ 提交于 2020-01-02 03:47:59
问题 I've got a row with 3 text widgets in it. The middle text entry can span several lines, but the first two will be really small. I'm wanting to have the first widget have the text at the top of the row and the 3rd widget to have the text at the bottom of the row. It's basically something similar to this image So basically the first widget would be the opening quote, then the 3rd the ending quote. I can set a crossAxisAlignment on the row to start or end and that will move the quotes, but it'll

Flutter - The method was called on null

拥有回忆 提交于 2020-01-02 00:57:10
问题 I'm programming an app that displays two media streams in the same view via one horizontal listView and one vertical listView . I'm currently working on implementing information into the bottom listView using some nice looking boilerplate that can be found here. I'm new to flutter and have believe my code has gotten a little messy, in short I'm receiving the error; flutter: The following NoSuchMethodError was thrown building Builder: flutter: The method 'loadCurrencies' was called on null.

How to solve ' RenderBox was not laid out:' in flutter in a card widget

醉酒当歌 提交于 2020-01-01 05:04:32
问题 I have a card that has three containers. The first two have text and the last one is supposed to hold a TextFormField alongside some text. So i have a row to hold the two along one another. Only thing is when i add the TextFormField widget it does not appear and the console throws shows an error ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ I/flutter (14101): The following assertion was thrown during performLayout(): I/flutter (14101):