Invalid Arabic characters With Utf-8 charset Retrived with http.get Flutter

The web server’s Content-Type header is Content-Type: text/html. Note that isn’t including a charset suffix. It should be saying Content-Type: text/html; charset=utf-8. The package:http client looks for this charset when asked to decode to characters. If it’s missing it defaults to LATIN1 (not utf-8). As you’ve seen, setting the headers on the Request doesn’t help, … Read more

Flutter floating action button with speed dial

Here’s a sketch of how to implement a Speed dial using FloatingActionButton. import ‘package:flutter/material.dart’; import ‘dart:math’ as math; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { @override State createState() => new MyHomePageState(); } … Read more

Multiple widgets used the same GlobalKey

Could you create your keys “by hand” and use static/constant values? e.g. … import ‘package:flutter/widgets.dart’; class RIKeys { static final riKey1 = const Key(‘__RIKEY1__’); static final riKey2 = const Key(‘__RIKEY2__’); static final riKey3 = const Key(‘__RIKEY3__’); } then in … body: new TabBarView( children: [ new RefreshIndicator(new RefreshIndicator( // Use the Manual Static Value instead … Read more

How do I crop an image in Flutter?

I would probably use a BoxDecoration with a DecorationImage. You can use the alignment and fit properties to determine how your image is cropped. You can use an AspectRatio widget if you don’t want to hard code a height on the Container. import ‘package:flutter/material.dart’; void main() { runApp(new MaterialApp( home: new MyHomePage(), )); } class … Read more

Navigate to a new screen in Flutter

Navigate to a new screen: Navigator.of(context).push(MaterialPageRoute(builder: (context) => NewScreen())); where context is the BuildContext of a widget and NewScreen is the name of the second widget layout. Code main.dart import ‘package:flutter/material.dart’; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: ‘Flutter Demo’, theme: ThemeData(primarySwatch: Colors.blue), home: HomeScreen(), … Read more

How can we change appbar background color in flutter

Declare your Color: const primaryColor = Color(0xFF151026); In the MaterialApp level (will change the AppBar Color in the whole app ) change primaryColor return MaterialApp( title: ‘Flutter Demo’, theme: ThemeData( primaryColor: primaryColor, ), home: MyApp(), ); and if you want to change it on the Widget level modify the backgroundColor appBar: AppBar( backgroundColor: primaryColor, ),