forked from OpenFlutter/Flutter-Notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
78 changes: 78 additions & 0 deletions
78
mecury_project/example/bottom_appbar_demo/lib/bottom_appBar_demo2.dart
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'each_view.dart'; | ||
|
||
class BottomAppBarDemo extends StatefulWidget { | ||
@override | ||
_BottomAppBarDemoState createState() => _BottomAppBarDemoState(); | ||
} | ||
|
||
class _BottomAppBarDemoState extends State<BottomAppBarDemo> { | ||
List<Widget> _eachView; | ||
int _index = 0; | ||
|
||
@override | ||
void initState() { | ||
// TODO: implement initState | ||
super.initState(); | ||
_eachView = List(); | ||
_eachView..add(EachView('home'))..add(EachView('me')); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: _eachView[_index], | ||
floatingActionButton: FloatingActionButton( | ||
backgroundColor: Colors.lightBlueAccent, | ||
elevation: 0, | ||
onPressed: () { | ||
Navigator.of(context) | ||
.push(MaterialPageRoute(builder: (BuildContext context) { | ||
return EachView('New Page'); | ||
})); | ||
}, | ||
tooltip: 'Increment', | ||
child: DecoratedBox( | ||
decoration: BoxDecoration( | ||
shape: BoxShape.circle, | ||
color: Colors.white, | ||
), | ||
child: SizedBox( | ||
height: 48, | ||
width: 48, | ||
child: Icon(Icons.add,color: Colors.lightBlueAccent,)), | ||
), | ||
), // T | ||
floatingActionButtonLocation: | ||
FloatingActionButtonLocation.centerDocked, // his | ||
bottomNavigationBar: BottomAppBar( | ||
elevation: 8, | ||
color: Colors.lightBlueAccent, | ||
child: Row( | ||
mainAxisSize: MainAxisSize.max, | ||
mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
children: <Widget>[ | ||
IconButton( | ||
icon: Icon(Icons.near_me), | ||
color: Colors.white, | ||
onPressed: () { | ||
setState(() { | ||
_index = 0; | ||
}); | ||
}, | ||
), | ||
IconButton( | ||
icon: Icon(Icons.edit_location), | ||
color: Colors.white, | ||
onPressed: () { | ||
setState(() { | ||
_index = 1; | ||
}); | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
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
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