Usage of FutureBuilder with setState

Indeed, it will loop into infinity because whenever build is called, updateList is also called and returns a brand new future. You have to keep your build pure. It should just read and combine variables and properties, but never cause any side effects! Another note: All fields of your StatefulWidget subclass must be final (widget.items … Read more

Creating Image Carousel in Flutter

Actually what you want is PageView. PageView accept a PageController as argument. And that controller possess a viewportFraction property (default to 1.0) which represent in percent the main-size of displayed pages. Which means that with a viewportFraction of 0.5, the main page will be centered. And you’ll see half a page on both left and … Read more

Flutter: Is it somehow possible to create App Widgets (Android) and Today Extensions (iOS)? [duplicate]

There is no guide or docs showing how to implement a App Widget for a flutter app. It is definitely possible to implement a app widget with native code. Just create a flutter project and open the android part with android studio, just implement your home screen widget, it’ll work like a charm. I just … Read more

How to detect orientation change in layout in Flutter?

In order to determine the Orientation of the screen, we can use the OrientationBuilder Widget. The OrientationBuilder will determine the current Orientation and rebuild when the Orientation changes. new OrientationBuilder( builder: (context, orientation) { return new GridView.count( // Create a grid with 2 columns in portrait mode, or 3 columns in // landscape mode. crossAxisCount: … Read more

Horizontally scrollable cards with Snap effect in flutter

Use PageView and ListView: import ‘package:flutter/material.dart’; main() => runApp(MaterialApp(home: MyHomePage())); class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(‘Carousel in vertical scrollable’), ), body: ListView.builder( padding: EdgeInsets.symmetric(vertical: 16.0), itemBuilder: (BuildContext context, int index) { if(index % 2 == 0) { return _buildCarousel(context, index ~/ 2); } else { … Read more

Flutter – How to set status bar color when AppBar not present

First, import services package: import ‘package:flutter/services.dart’; Next, simply put this in the build function of your App: SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Colors.blue, //or set color with: Color(0xFF0000FF) )); Additionally, you can set useful properties like: statusBarIconBrightness, systemNavigationBarColor or systemNavigationBarDividerColor If you prefer a more flutter/widget way of doing the same thing, consider using the AnnotatedRegion<SystemUiOverlayStyle> widget. The … Read more