Flutter

Flutter :- How to scroll the sceen without shrink the screen on the Stack view?(Scroll the the whole screen when the keyboard appears )

你。 提交于 2021-01-28 19:17:07
问题 Description I am creating the login screen in which I have used the Stack widget, Currently, everything works fine but only one issue of the shrinking the view. When I use the resizeToAvoidBottomPadding: false inside the Scaffold then screen shrinking disappear but another problem arise that whole screen scroll not working, please check below lines of code class _LoginScreen extends State<LoginScreen> { @override Widget build(BuildContext context) { // TODO: implement build return Scaffold(

How do i change the color and text of Container at onTap event in FLUTTER

一世执手 提交于 2021-01-28 19:13:22
问题 I have two containers in a row and what i want to do is when i click the 1st container it changes its color as well as the 2nd container i.e. - when i click on 1st container it make it look like selected and the other one deselected and same as on 2nd container. Is there anyway to do that? GestureDetector( onTap: () { print('its getting pressed'); }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Expanded( child:

flutter checkbox not working in StatelessWidget

橙三吉。 提交于 2021-01-28 19:10:30
问题 Here is my class class Home extends StatelessWidget { and the Checkbox goes here. @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: EdgeInsets.all(20.0), child: Column( children: <Widget>[ TextField( controller: ctrlMotherName, decoration: InputDecoration( labelText: "Name of Mother", border: OutlineInputBorder() ) ),

Flutter split and make specific word bold [closed]

蹲街弑〆低调 提交于 2021-01-28 19:09:44
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 10 months ago . Improve this question I have string which is like "Hi @username how are you" I want to change @username text to bold... just @username not whole sentence Example : " Hi @username how are you 回答1: This is a small function that would do that for you then returns a list of widgets. List<Text>

How to create a BlocListener that can listen to all pages in flutter with access to MaterialApp context?

荒凉一梦 提交于 2021-01-28 19:05:25
问题 I'm trying to create a BlocListener that has the ability to listen to all pages/routes throughout the app just like how you can access a Bloc or a Provider all throughout the app if they are defined at root-level like in the code below runApp( MultiProvider( providers: [ ChangeNotifierProvider<IdentityTokenProvider>( create: (_) => IdentityTokenProvider(), ), ], child: MultiBlocProvider( providers: [ BlocProvider<AuthBloc>( create: (_) => AuthBloc(), ), ], child: MaterialApp(

Flutter adding Draggable Scrollbar to a CustomScrollView? It keeps giving me 'The argument type CustomScrollView can't be assigned to BoxScrollView'

穿精又带淫゛_ 提交于 2021-01-28 19:00:36
问题 A Simple example would be: Scaffold( floatingActionButton: _fab(), floatingActionButtonLocation: _fabLocation(), body: Scrollbar( child: CustomScrollView( slivers: <Widget>[ SliverAppBar( automaticallyImplyLeading: false, leading: null, backgroundColor: Theme.of(context).colorScheme.secondary, title: AutoSizeText( _catalogSearchRatio, style: Theme.of(context).textTheme.title.copyWith( color: Theme.of(context).colorScheme.onSecondary), ), floating: true, pinned: false, ), SliverFixedExtentList

Add a prefix to every line in a multiline Text Input in Flutter?

北城余情 提交于 2021-01-28 18:54:53
问题 I wanted to know if there was a way of adding a prefix (like "- ") to every line in a multiline Text Input in Flutter. For example: Hello World! Would become: -Hello -World! This is my code: TextField( maxLines: null, controller: _elementsController, textCapitalization: TextCapitalization.sentences, style: TextStyle( fontSize: 18.0, ), decoration: InputDecoration( contentPadding: EdgeInsets.all(0.0), labelText: 'Elements', ), ), 回答1: U can add a - everytime a new line is created. Add this in

Get URL of a http get request in flutter app

可紊 提交于 2021-01-28 18:44:17
问题 I am trying to get the URL of the following get request; String url = ['url_here']; Future<Post> fetchPost() async { final response = await http.get(url); if (response.statusCode == 200) { return Post.fromJson(json.decode(response.body)); } else { throw Exception('Failed to load post'); } } I get a statuscode of 200. Any ideas? To clarify, When you enter the url in a browser it brings me to a page with a url that has a code in it. I am trying to extract that code. 回答1: followRedirects is true

How to change android icon in flutter?

我的梦境 提交于 2021-01-28 18:41:11
问题 After running a flutter app, it gets correctly deployed to an Android Virtual Device. While in the virtual device, I can notice that the icon chosen for the app shows up correctly among other existing apps. But, when I tap to see running processes, an Android icon appears at the top of the flutter app window. Icons were manually added as described here. How can I change this default icon to use mine? 回答1: Check again your AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com

Flutter (stable) run for Android throwToolExit (package:flutter_tools/src/base/common.dart:14:3)

ⅰ亾dé卋堺 提交于 2021-01-28 18:30:54
问题 Does anyone know about this issue? I run flutter run -v on MacOS for an physical Android device, get exception says throwToolExit (package:flutter_tools/src/base/common.dart:14:3) and blah blah blah. Attached log of flutter run -v My flutter is on stable channel and healthy, any help would be very appreciate! [✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.14.6 18G103, locale en-CN) • Flutter version 1.17.0 at /Volumes/Transcend/Development/flutter • Framework revision e6b34c2b5c (7 days