Created
June 3, 2019 20:48
-
-
Save Andrious/4301db62bad4f6c102f9c4ded8fbcdf0 to your computer and use it in GitHub Desktop.
Demonstration Scaffold with appBar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatefulWidget { | |
MyApp({Key key}) : super(key: key); | |
State createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin { | |
TabController controller; | |
@override | |
void initState() { | |
super.initState(); | |
controller = TabController(length: 3, vsync: this); | |
} | |
@override | |
Widget build(BuildContext context) { | |
final ThemeData theme = Theme.of(context); | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar( | |
leading: IconButton( | |
icon: Icon(Icons.home), | |
tooltip: 'Click to Home Screen', | |
onPressed: () {}), | |
automaticallyImplyLeading: true, | |
title: Text('My Fancy Dress'), | |
actions: <Widget>[ | |
IconButton( | |
icon: Icon(Icons.playlist_play), | |
tooltip: 'Air it', | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.playlist_add), | |
tooltip: 'Restitch it', | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.playlist_add_check), | |
tooltip: 'Repair it', | |
onPressed: () {}, | |
), | |
], | |
flexibleSpace: Image.network( | |
"https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350", | |
fit: BoxFit.cover, | |
), | |
bottom: TabBar( | |
tabs: [ | |
Tab(text: 'Tab 1'), | |
Tab(text: 'Tab 2'), | |
Tab(text: 'Tab 3'), | |
], | |
controller: controller, | |
), | |
elevation: 16, | |
backgroundColor: theme.primaryColor, | |
brightness: theme.primaryColorBrightness, | |
iconTheme: theme.primaryIconTheme, | |
actionsIconTheme: theme.appBarTheme.actionsIconTheme, | |
textTheme: theme.textTheme, | |
primary: true, | |
shape: StadiumBorder(), | |
centerTitle: true, | |
toolbarOpacity: 1.0, | |
bottomOpacity: 1.0, | |
), | |
body: Center( | |
child: TabBarView( | |
controller: controller, | |
children: <Widget>[ | |
Text("Content for Tab 1"), | |
Text("Content for Tab 2"), | |
Text("Content for Tab 3"), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment