flutter-layout

Flutter bottom padding color on iPhone

我们两清 提交于 2021-01-24 20:22:46
问题 is it possible to change the color of this bottom padding that comes with the iPhone ? 回答1: Wrap your MaterialApp with below code in main.dart class :- AnnotatedRegion<SystemUiOverlayStyle>( value: SystemUiOverlayStyle( statusBarColor: Colors.transparent, //set as per your status bar color systemNavigationBarColor: Colors.black, //set as per your navigation bar color statusBarIconBrightness: Brightness.dark, //set as per your status bar icons' color systemNavigationBarIconBrightness:

What is the difference between an “Image” and “ImageProvider” in Flutter?

江枫思渺然 提交于 2021-01-22 04:20:32
问题 There are answers related to this topic but they offer workarounds rather than explanations. Why can't an Image be used where an ImageProvider is required? Conceptually they sound the same to me. child: new CircleAvatar( backgroundImage: NetworkImage("https..."), // works backgroundImage: Image.asset('images/image.png'), // error ), The error generated by trying to use an image directly is: error: The argument type 'Image' can't be assigned to the parameter type 'ImageProvider'. 回答1: An Image

How to add custom Strikethrough to Text Widget in Flutter

戏子无情 提交于 2021-01-21 11:17:38
问题 I am looking for a way to add a custom strikethrough to a text widget like below I looked at the Text Style API, but couldn't find any option to customize the Strikethrough graphic. style: TextStyle(decoration: TextDecoration.lineThrough), 回答1: as an option import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Center( child: StrikeThroughWidget(

Flutter - How to make a custom TabBar

不打扰是莪最后的温柔 提交于 2021-01-21 10:10:39
问题 This is the output that I want. I am still new in flutter so can anyone let me know if there is already a widget for this kind of switch or how should I make one ?? Also, I want the data shown below this button to change if I choose the other button but I guess that's obvious. Thanks in advance. 回答1: You can use the TabBar widget to achieve this. I added a full example demonstrating how you can create this using the TabBar widget: CODE class StackOver extends StatefulWidget { @override

Flutter - How to make a custom TabBar

瘦欲@ 提交于 2021-01-21 10:07:12
问题 This is the output that I want. I am still new in flutter so can anyone let me know if there is already a widget for this kind of switch or how should I make one ?? Also, I want the data shown below this button to change if I choose the other button but I guess that's obvious. Thanks in advance. 回答1: You can use the TabBar widget to achieve this. I added a full example demonstrating how you can create this using the TabBar widget: CODE class StackOver extends StatefulWidget { @override

Design this animation using SliverAppBar flutter

寵の児 提交于 2021-01-20 18:38:46
问题 Here's what I want to build but I am able to achieve this by the following code, @override Widget build(BuildContext context) { return Scaffold( body: NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled){ return [ SliverAppBar( expandedHeight: 120, floating: false, pinned: false, flexibleSpace: Container( padding: EdgeInsets.all(10), height: 160, width: double.infinity, child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment:

AnimatedSwitcher with IndexedStack

我们两清 提交于 2021-01-18 05:39:06
问题 I have to use IndexedStack to maintain the state of my widgets for my BottomNavigationBar. Now i want to use AnimatedSwitcher (or an alternative) to create an animation when i switch tabs. I'm having issues getting AnimatedSwitcher to trigger on change of IndexedStack. I'm having IndexedStack as the child of AnimatedSwitcher, which obviously causes AnimatedSwitcher to not trigger because the IndexedStack widget doesn't change, only it's child. body: AnimatedSwitcher( duration: Duration

AnimatedSwitcher with IndexedStack

人盡茶涼 提交于 2021-01-18 05:39:05
问题 I have to use IndexedStack to maintain the state of my widgets for my BottomNavigationBar. Now i want to use AnimatedSwitcher (or an alternative) to create an animation when i switch tabs. I'm having issues getting AnimatedSwitcher to trigger on change of IndexedStack. I'm having IndexedStack as the child of AnimatedSwitcher, which obviously causes AnimatedSwitcher to not trigger because the IndexedStack widget doesn't change, only it's child. body: AnimatedSwitcher( duration: Duration

How to get Containers to fill available vertical space in a Row?

回眸只為那壹抹淺笑 提交于 2021-01-07 03:48:39
问题 can anyone help me out? I'm struggling to figure out how I can get the coloured containers to extend to match the height of the tallest one in their row. Currently they have no fixed height/width and are wrapped in Expanded widgets to get their dynamic size. I'd like to keep their responsive sizes if possible. I already have a method in place to switch to a Column instead of a Row once the screen is small enough. Once in a Column I can use width: double.infinity because there is no horizontal

Flutter listview builder Scroll controller listener not firing inside list view?

一个人想着一个人 提交于 2021-01-06 05:01:11
问题 I have a listview builder widget inside another list view. Inner listview listener is not firing when scrolling position reaches to its end. initState() { super.initState(); _scrollController.addListener(() { if (_scrollController.position.maxScrollExtent == _scrollController.position.pixels) {function();} } Container( child: Listview( children: <Widget>[ Container(), ListView.builder( controller: _scrollController, physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: list