import 'package:flutter/material.dart';
class NewUpdatePage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _NewUpdatePage();
}
}
class _NewUpdatePage extends State<NewUpdatePage> {
int index = 0;
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: <Widget>[
Text('index = $index'),
FlatButton(
child: Text('button'),
onPressed: () {
setState(() {
index++;
});
},
),
],
),
);
}
}
class Page extends StatelessWidget {
String title;
Page(this.title);
@override
Widget build(BuildContext context) {
return new Container(
child: new Center(
child: new Text(title),
),
);
}
}
class _MainPage extends State<MainPage> with SingleTickerProviderStateMixin {
TabController _controller;
int index = 0;
static const _kDuration = const Duration(milliseconds: 300);
static const _kCurve = Curves.ease;
final List<Widget> _pages = <Widget>[
NewUpdatePage(),
Page('the other one!'),
Page('headset is on?'),
Page('headset is on?')
];
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = new TabController(length: 4, vsync: this);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Truyen Tranh'),
),
body: TabBarView(
controller: _controller,
children: _pages,
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: index,
onTap: (i){
_controller.animateTo(i);
setState(() {
index = i;
});
},
items: [
BottomNavigationBarItem(
icon: Theme(
data: new ThemeData(),
child: const Icon(
Icons.home,
color: Colors.pink,
)),
title: Text('Home'),
),
BottomNavigationBarItem(
icon: Theme(
data: new ThemeData(),
child: const Icon(
Icons.calendar_today,
color: Colors.pink,
)),
title: Text('Home2'),
),
BottomNavigationBarItem(
icon: Theme(
data: new ThemeData(),
child: const Icon(
Icons.calendar_today,
color: Colors.pink,
)),
title: Text('Home3'),
),
BottomNavigationBarItem(
icon: Theme(
data: new ThemeData(),
child: const Icon(
Icons.calendar_today,
color: Colors.pink,
)),
title: Text('Home4'),
),
],
),
);
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.