Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:seller_app/prodonsale.dart';
- import 'package:seller_app/product.dart';
- import 'package:seller_app/video.dart';
- import 'package:seller_app/class.dart';
- import 'package:seller_app/about.dart';
- class navigationbar extends StatefulWidget {
- @override
- _navigationbarState createState() => _navigationbarState();
- }
- class _navigationbarState extends State<navigationbar> {
- final List<Widget> pages = [
- Prodonsale(
- key: PageStorageKey('Page1'),
- ),
- Product(
- key: PageStorageKey('Page2'),
- ),
- Video(
- key: PageStorageKey('Page3'),
- ),
- ];
- final PageStorageBucket bucket = PageStorageBucket();
- int _selectedIndex = 0;
- Widget _bottomNavigationBar(int selectedIndex) => BottomNavigationBar(
- onTap: (int index) => setState(() => _selectedIndex = index),
- currentIndex: selectedIndex,
- items: const <BottomNavigationBarItem>[
- BottomNavigationBarItem(
- icon: Icon(Icons.account_box), title: Text('My Products')),
- BottomNavigationBarItem(
- icon: Icon(Icons.store), title: Text('Sell Craft')),
- BottomNavigationBarItem(
- icon: Icon(Icons.video_library), title: Text('Sell Tutorials')),
- ],
- );
- void choiceAction(String choice){
- if(choice == Constants.About){
- Navigator.push(context, MaterialPageRoute(
- builder: (BuildContext context) => About()
- ));
- }
- else if(choice == Constants.SignOut){
- Navigator.pop(context);
- }
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: new AppBar(
- leading: new Container(),
- title: new Text("Craft House"),
- backgroundColor: Colors.red,
- actions: <Widget>[
- PopupMenuButton<String>(
- onSelected: choiceAction,
- itemBuilder: (BuildContext context){
- return Constants.choices.map((String choice){
- return PopupMenuItem<String>(
- value: choice,
- child: Text(choice),
- );
- }).toList();
- },
- )
- ],
- ),
- bottomNavigationBar: _bottomNavigationBar(_selectedIndex),
- body: PageStorage(
- child: pages[_selectedIndex],
- bucket: bucket,
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement