how to implement a sliverAppBar with a tabBar

Use NestedScrollView, here is the working code. @override Widget build(BuildContext context) { return Scaffold( body: DefaultTabController( length: 2, child: NestedScrollView( headerSliverBuilder: (context, value) { return [ SliverAppBar( bottom: TabBar( tabs: [ Tab(icon: Icon(, text: “Call”), Tab(icon: Icon(Icons.message), text: “Message”), ], ), ), ]; }, body: TabBarView( children: [ CallPage(), MessagePage(), ], ), ), ), ); … Read more

How to Animate Collapsing Elements in Flutter

If you want to collapse a widget to zero height or zero width that has a child that overflow when collapsed, I would recommend SizeTransition or ScaleTransition. Here is an example of the ScaleTransition widget being used to collapse the container for the four black buttons and status text. My ExpandedSection widget is used with … Read more

How can I detect if my Flutter app is running in the web?

There is a global boolean kIsWeb which can tell you whether or not the app was compiled to run on the web. Documentation: import ‘package:flutter/foundation.dart’ show kIsWeb; if (kIsWeb) { // running on the web! } else { // NOT running on the web! You can check for additional platforms here. }

Difference between List.from() and as List in Dart

Let’s examine some examples: var intList = <int>[1, 2, 3]; var dynamicList = intList as List<dynamic>; // Works. var intList2 = dynamicList as List<int>; // Works. But: var dynamicList = <dynamic>[1, 2, 3]; var intList = dynamicList as List<int>; // Fails at runtime. What’s the difference? In the first example, intList has a static type … Read more

Outlined transparent button with gradient border in flutter

I spent about two hours on it 🙂 how to use: import ‘package:flutter/material.dart’; void main() => runApp(App()); class App extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: SafeArea( child: Center( child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ UnicornOutlineButton( strokeWidth: 2, radius: 24, gradient: LinearGradient(colors: [, Colors.redAccent]), child: Text(‘OMG’, style: TextStyle(fontSize: 16)), … Read more