flutter-layout

How to highlight a word in string in flutter programmatically

只谈情不闲聊 提交于 2019-12-22 05:14:05
问题 Is there any way to change color on particular word in a string ? Text("some long string") now i want to give color to only long word. can someone tell me how can i do this programatically ? eg:- I am long a really long and long string in some variable, a long one now here i want to seperate long word. I can seperate simple string to highlight one word but not sure how to find and highlight each of these words. 回答1: Wrap the word in a TextSpan and assign style properties to change the text

Make scrollable Text inside container in Flutter

為{幸葍}努か 提交于 2019-12-22 01:24:12
问题 I'm trying to create a scrollable Text inside a view: // other widgets, SingleChildScrollView( child: Container( height: 200, child: Text( "Long text here which is longer than the container height"))), // other widgets The text is longer than the height of its parent container, but for some reason the text is not scrollable although it is wrapped inside SingleChildScrollView . Any idea what I'm doing wrong? 回答1: Try to add scrollDirection (horizontal) SingleChildScrollView( scrollDirection:

What's the correct way to add splash screen in flutter app?

不问归期 提交于 2019-12-22 01:09:40
问题 I am developing a flutter based app and studied there are couple of ways to add splash screen. But I am not sure which one is the best to achieve. 回答1: import 'dart:async'; import 'package:flutter/material.dart'; import 'package:mingup/screen/login_screen.dart'; // This is the Splash Screen class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin{

Can Flutter efficiently layout nested lists?

谁说胖子不能爱 提交于 2019-12-21 22:29:13
问题 Can a layout like this be achieved and rendered efficiently in Flutter? Example: Yellow and blue blocks can both be around 30 elements, so I guess something like ListView.builder should be used. I have tried nesting 2 ListView.builder, the inner with shrinkWrap = true. The yellow block is being built just when is needed, but the blue list, although it has an itemBuilder, it builds all children elements at once, causing performance problems. new ListView.builder( itemCount: 20, itemBuilder:

Keyboard not being detected. MediaQuery.of(context).viewInsets.bottom always returns 0.0

我们两清 提交于 2019-12-21 19:55:38
问题 I have a scaffold with a TextField inside. The keyboard always covers this field when it previously would move the field above the keyboard. This is happening on all the pages in my project. I've added MediaQuery.of(context).viewInsets.bottom to my build method and it always returns 0.0. When the keyboard comes up there is no rebuild. I've tried settings resizeToAvoidBottomInset to true and false with no change. I've tried wrapping it in a Scrollable widget, no change. Everything works fine

Using FocusNode in TextFormField Flutter

最后都变了- 提交于 2019-12-21 17:39:38
问题 I have a TextFormField that is supposed to receive digits. On entry of first digit it should jump to second TextFormField then to the third TextFormField. Each TextFormField has the FocusNode property I just do not know how to use it. I have this TextFormField( //First Field autofocus: true, focusNode: FocusNode(), decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(4.0) ), ), style: TextStyle( color: Colors.orange, fontSize: 15.0, ), keyboardType:

Flow Layout in flutter example

风格不统一 提交于 2019-12-21 05:07:24
问题 i want to implement flow layout in flutter i found a class called FLOW in sdk but unable to find sample code on how to use it here is the layout i am trying to achieve 回答1: Use Wrap instead of Flow . Flow is for more complicated custom layout. Wrap is what is used to achieve the layout in your screenshot. new Wrap( spacing: 8.0, // gap between adjacent chips runSpacing: 4.0, // gap between lines children: <Widget>[ new Chip( avatar: new CircleAvatar(backgroundColor: Colors.blue.shade900,

Expand The App bar in Flutter to Allow Multi-Line Title?

强颜欢笑 提交于 2019-12-20 20:18:15
问题 Does anyone know how I can create an app bar with a multi-line title, as per the material guidelines show here? https://material.io/design/components/app-bars-top.html#anatomy Any ideas how to do this? It seems like it should be straightforward given that it's part of the material guidelines! Worth pointing out that the title is user defined, so I want to allow the app bar to expand from a single line to multiple lines (perhaps with a limit imposed) depending on user input. Mike 回答1: This is

Hide Bottom Navigation bar on Scroll in Flutter

拜拜、爱过 提交于 2019-12-20 16:24:00
问题 I have a list of blog posts in the body and bottom navigation bar. I want to hide bottom navigation bar with a slide down animation when the posts list is scrolled down and visible with a slide up animation when scrolled up. How to do it? 回答1: This solution is just a workaround to this problem. There may be some detrimental changes. import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget {

Hide Bottom Navigation bar on Scroll in Flutter

时光总嘲笑我的痴心妄想 提交于 2019-12-20 16:22:09
问题 I have a list of blog posts in the body and bottom navigation bar. I want to hide bottom navigation bar with a slide down animation when the posts list is scrolled down and visible with a slide up animation when scrolled up. How to do it? 回答1: This solution is just a workaround to this problem. There may be some detrimental changes. import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget {