Posts

State

From: Stackoverflow initState()  is a method which is called once when the stateful widget is inserted in the widget tree.  We generally override this method if we need to do some sort of initialisation work like registering a listener because unlike  build()  this method is called once.  And to unregister your listener (or doing some post work), you override  dispose() method.

Text and Color

https://docs.flutter.io/flutter/painting/TextStyle-class.html Text Style Class Text( style: TextStyle(fontStyle: FontStyle.italic), ), Background Color Add container and add color child : new Container ( width : 80.0 , height : 80.0 , margin : new EdgeInsets . all ( 10.0 ), color : Colors . orange ,), https://docs.flutter.io/flutter/dart-ui/Color-class.html An immutable 32 bit color value in ARGB format. Color c = const Color( 0xFF42A5F5 ); Color c = const Color.fromARGB( 0xFF , 0x42 , 0xA5 , 0xF5 ); Color c = const Color.fromARGB( 255 , 66 , 165 , 245 ); Color c = const Color.fromRGBO( 66 , 165 , 245 , 1.0 ); Color c1 = const Color( 0xFFFFFF ); // fully transparent white (invisible) Color c2 = const Color( 0xFFFFFFFF ); // fully opaque white (visible) https://docs.flutter.io/flutter/dart-ui/Color/Color.fromARGB.html Construct a color from the lower 8 bits of four integers. a  is the alpha value, with 0 bein...

Conditional Expression and Control Flow

Conditional expressions Dart has two operators that let you concisely evaluate expressions that might otherwise require  if-else  statements: 1.condition  ?  expr1  :  expr2 If  condition  is true, evaluates  expr1  (and returns its value); otherwise, evaluates and returns the value of  expr2 . 2.expr1  ??  expr2 If  expr1  is non-null, returns its value; otherwise, evaluates and returns the value of  expr2 . When you need to assign a value based on a boolean expression, consider using  ?: .

Animation Class: Mixin

https://medium.com/flutter-community/dart-what-are-mixins-3a72344011f3 void main(){ runApp( new MaterialApp(home: new AnimationTest())); } class AnimationTest extends StatefulWidget { @override _AnimationTestState createState() => _AnimationTestState(); } class _AnimationTestState extends State<AnimationTest> with SingleTickerProviderStateMixin{ AnimationController animationController ; @override void initState() { // TODO: implement initState super .initState(); animationController = new AnimationController( vsync: this , duration: new Duration(seconds: 5 ), ); animationController .addListener((){ this .setState((){}); }); } @override Widget build(BuildContext context) { return new GestureDetector( child: new Container( color:Colors. white , child: new Center( child: new Text( animationController . isAnimating ? animationController . value .toStringAsFixed( 3...

Animation Class: AppBar and Tabbar

App Bar https://flutter.io/docs/catalog/samples/basic-app-bar https://material.io/design/components/app-bars-top.html#theming https://docs.flutter.io/flutter/material/AppBar-class.html The AppBar displays the toolbar widgets leading title actions bottom   TabBar . Declaring new method inside widget by (){}; void main(){ runApp( new MaterialApp(home: new AppTest1())); } class AppTest1 extends StatefulWidget { @override _AppTest1State createState() => _AppTest1State(); } class _AppTest1State extends State<AppTest1> { String bodyText = " " ; @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( backgroundColor: Colors. red , leading: new Icon (Icons. laptop_chromebook ), title: new Text( "Appbar Title" ), //centerTitle: true, //titleSpacing: 80.0, elevation: 10.00 , actions: <Widget>[ new IconButton(icon: new Icon(...

ListView Link to GridView

https://docs.flutter.io/flutter/material/TabController-class.html TabController class Coordinates tab selection between a  TabBar  and a  TabBarView . Constructor: TabController ({ int   initialIndex :  0 ,  @required  int   length ,  @required  TickerProvider   vsync  }) Creates an object that manages the state required by  TabBar  and a  TabBarView . TickerProvider Interface that Vend Ticker Object Tickers can be used by any object that wants to be notified whenever a frame triggers, but are most commonly used indirectly via an  AnimationController . Tickers calls its callback once per animation frame. When created, it is initially disabled. Start: enabled, Stop: disabled Vsync is a ticker provider used by contoller. https://medium.com/@vignesh_prakash/flutter-listview-and-gridview-with-tabbar-221516518c75 import 'package:flutter/material.dart' ; import 'package:flutter...