Hide FAB when onscreen keyboard appear

You can achieve it by checking for keyboard visibility using viewInsets and hide fab based on it. Example: import ‘package:flutter/material.dart’; void main() { runApp(new MaterialApp( title: “Example”, home: new FabHideOnKeyboard(), )); } class FabHideOnKeyboard extends StatefulWidget { @override _FabHideOnKeyboardState createState() => new _FabHideOnKeyboardState(); } class _FabHideOnKeyboardState extends State<FabHideOnKeyboard> { @override Widget build(BuildContext context) { final … Read more

How to apply theme on MaterialButton or RaisedButton?

One way to do it is to Define buttonTheme in theme in MaterialApp: E.g: void main() { runApp(MaterialApp( home: Home(), theme: ThemeData( accentColor: Colors.redAccent, buttonTheme: ButtonThemeData( buttonColor: Colors.blueAccent, shape: RoundedRectangleBorder(), textTheme: ButtonTextTheme.accent, …. )), )); } class Home extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(“Button Theme”), backgroundColor: Colors.green), body: … Read more

How to save and download text file in Flutter web application

This method is based on manipulations with an HTML document. Some additional packages should be imported: import ‘dart:convert’; import ‘dart:html’ as html; // or package:universal_html/prefer_universal/html.dart Code snippet: final text=”this is the text file”; // prepare final bytes = utf8.encode(text); final blob = html.Blob([bytes]); final url = html.Url.createObjectUrlFromBlob(blob); final anchor = html.document.createElement(‘a’) as html.AnchorElement ..href = … Read more

Error: ‘ModalBottomSheetRoute’ is imported from both

The reason behind the error is says both material/bottom_sheet.dart and bottom_sheet_route exports the ModalBottomSheetRoute. ‘ModalBottomSheetRoute’ is imported from both ‘package:flutter/src/material/bottom_sheet.dart’ and ‘package:modal_bottom_sheet/src/bottom_sheet_route.dart’. In order to fix this issue we have to hide one of the ModalBottomSheetRoute. since we need this to be imported from bottom_sheet_route we need to hide it from material This is the … Read more

flutter –flow-control-collections are needed, but are they?

Hey, I had the same issue this morning but found a fix. 1) Keep the analysis_options.yaml in your root folder with this code: analyzer: enable-experiment: – control-flow-collections 2) Don’t use brackets {} in between your for loops Ex: <Widget>[ for (final category in categories) CategoryWidget(category: category) ], 3) Important step which is probably why it’s … Read more