Posts

Showing posts from June, 2020

|9| Transform Slider

Image
Transform Slider: import 'dart:math' ; import 'package:flutter/material.dart' ; void main() { runApp( MyApp ()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp ( debugShowCheckedModeBanner: false , home: MyHome (), ); } } class MyHome extends StatefulWidget { @override _MyHomeState createState() => _MyHomeState (); } class _MyHomeState extends State<MyHome> { PageController pageController ; double viewportFraction = 0.8 ; double pageOffset = 0 ; @override void initState() { super .initState(); pageController = PageController (initialPage: 0 , viewportFraction: viewportFraction ) ..addListener(() { setState(() { pageOffset = pageController . page ; }); }); } @override Widget build(BuildContext context) { return Scaffold ( appBar: AppBar ( title: Text ( "Transform Slider" ...

|8| Routes

Image
Routes: import 'package:flutter/material.dart' ; void main() { runApp( MyApp ()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp ( debugShowCheckedModeBanner: false , home: MyHome (), ); } } class MyHome extends StatefulWidget { @override _MyHomeState createState() => _MyHomeState (); } class _MyHomeState extends State<MyHome> { @override Widget build(BuildContext ctx) { return Scaffold ( appBar: AppBar ( title: Text ( "Page 1" ), backgroundColor: Colors. black45 , elevation: 1.0 , ), body: Center ( child: FlatButton ( color: Colors. blue [ 300 ], onPressed: (){ Navigator. push (ctx, PageTwo ()); }, child: Text ( "Go to Page 2" ), ), ), ); } } class PageTwo extends MaterialPageRoute<Null> { PageTwo() : super (bu...

|7| DraggableScrollableSheet

Image
DraggableScrollableSheet: import 'package:flutter/material.dart' ; // import 'package:ui_flutter/core/res/utils.dart'; void main() { runApp( MyApp ()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp ( debugShowCheckedModeBanner: false , home: MyHome (), ); } } class MyHome extends StatefulWidget { @override _MyHomeState createState() => _MyHomeState (); } class _MyHomeState extends State<MyHome> { @override Widget build(BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( 'DraggableScrollableSheet' ), backgroundColor: Colors. black12 , ), body: Stack ( children: <Widget>[ SizedBox . expand ( child: Container ( color: Colors. yellow [ 300 ], ), ), _buildDraggableScrollableSheet(), ], ), );...

|6| Stack

Image
Stack: import 'package:flutter/material.dart' ; void main() { runApp( MyApp ()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp ( debugShowCheckedModeBanner: false , home: MyHomepage (), ); } } class MyHomepage extends StatefulWidget { @override _MyHomepageState createState() => _MyHomepageState (); } class _MyHomepageState extends State<MyHomepage> { AlignmentDirectional _alignmentDirectional = AlignmentDirectional. centerStart ; @override Widget build(BuildContext context) { return Scaffold ( appBar: AppBar ( title: Text ( "Stack" , style: TextStyle ( // color: Colors.pink ), ), backgroundColor: Colors. purple , ), body: Center ( child: Stack ( alignment: _alignmentDirectional , children: <Widget>[ Container (width: 3...

|5| Wrap

Image
Wrap: import 'package:flutter/material.dart' ; void main() { runApp( MyApp ()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp ( debugShowCheckedModeBanner: false , home: MyHomepage (), ); } } class MyHomepage extends StatefulWidget { @override _MyHomepageState createState() => _MyHomepageState (); } class _MyHomepageState extends State<MyHomepage> { @override Widget build(BuildContext context) { return Scaffold ( appBar: AppBar ( title: Text ( "Wrap" ), ), body: Wrap ( spacing: 14.0 , // Gap between lines. runSpacing: 8.0 , direction: Axis. horizontal , children: [ 'Flutter' , 'Dart' , 'Android' , 'Widget' , 'Youtube' , 'Facebook' , 'Google'...

|4| Animated Container:

Image
Animated Container: import 'dart:math' ; import 'package:flutter/material.dart' ; void main() { runApp( MyApp ()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp ( debugShowCheckedModeBanner: false , title: "Opacity" , home: MyHomepage (), ); } } class MyHomepage extends StatefulWidget { @override _MyHomepageState createState() => _MyHomepageState (); } class _MyHomepageState extends State<MyHomepage> { final _rng = Random (); double _height = 100 ; double _width = 100 ; double _borderRadius = 8 ; Color _color = Colors. blue ; @override void initState() { super .initState(); } @override Widget build(BuildContext context) { return Scaffold ( appBar: AppBar ( title: Text ( "Animated Container" ), ), body: Center ( child: Padding ( padding: EdgeIns...

|3| Opacity

Image
Opacity: import 'package:flutter/material.dart' ; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false , title: "Page Selector" , home: MyHomepage( ), ); } } class MyHomepage extends StatefulWidget { @override _MyHomepageState createState() => _MyHomepageState(); } class _MyHomepageState extends State<MyHomepage> { double _s1 = 1.0 , _s2 = 1.0 , _s3 = 1.0 , _s4 = 1.0 ; Widget _coloredSquare(Color color) { return Container( height: 90.0 , width: 90.0 , color: color, ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( "Opacity" , ), ), body: Center( child: Padding( padding: EdgeInsets.all( 10.0 ), child: Column( mainAxis...

|2| Page Selector

Image
Flutter |2| Page Selector: import 'package:flutter/material.dart' ; void main() { runApp( MyApp ()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp ( debugShowCheckedModeBanner: false , title: "Bottam AppBar" , home: MyHomepage (), ); } } class MyHomepage extends StatefulWidget { @override _MyHomepageState createState() => _MyHomepageState (); } class _MyHomepageState extends State<MyHomepage> { static const kIcons = <Icon>[ Icon (Icons. home ), Icon (Icons. contact_phone ), Icon (Icons. android ), Icon (Icons. account_balance_wallet ), Icon (Icons. face ), Icon (Icons. language ), Icon (Icons. watch_later ), ]; @override Widget build(BuildContext context) { return DefaultTabController ( length: kIcons . length , child: Builder ( builder: (BuildContext context) => Padding ( ...

|1| Bottom AppBar

Image
Flutter |1| Bottom AppBar: import 'package:flutter/material.dart' ; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false , title: "Bottam AppBar" , theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomepage(), ); } } class MyHomepage extends StatefulWidget { @override _MyHomepageState createState() => _MyHomepageState(); } class _MyHomepageState extends State<MyHomepage> { @override Widget build(BuildContext context) { return Scaffold( floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: FloatingActionButton( child: const Icon(Icons.add), onPressed: () {}, ), bottomNavigationBar: BottomAppBar( color: Colors.red, shape: CircularNotchedRectangle(), notchMargin...