Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:camera/camera.dart';
- import 'package:flutter/material.dart';
- import './settings.dart';
- import './Chats.dart';
- import './camera.dart';
- import 'dart:async';
- List<CameraDescription> cameras;
- Future<Null> main() async {
- WidgetsFlutterBinding.ensureInitialized();
- cameras = await availableCameras();
- runApp(MyApp());
- }
- class MyApp extends StatefulWidget {
- final List<CameraDescription> cameras;
- MyApp({this.cameras});
- @override
- _MyAppState createState() => _MyAppState();
- }
- class _MyAppState extends State <MyApp>{
- int pagePressed=1;
- @override
- Widget build(BuildContext context) {
- final page =[ CameraScreen(widget.cameras) ,Chats(), Settings()
- ];
- return MaterialApp(
- debugShowCheckedModeBanner: false ,
- home: Scaffold(
- body: page[pagePressed],
- bottomNavigationBar: BottomNavigationBar(
- currentIndex: pagePressed ,
- onTap: (int index){
- setState(() {
- pagePressed=index;
- });
- },
- iconSize: 23,
- selectedFontSize: 17 ,
- unselectedFontSize: 13,
- items: [
- BottomNavigationBarItem(
- icon: Icon(Icons.camera_alt),
- title: Text('Camera'),
- ),
- BottomNavigationBarItem(
- icon: Icon(Icons.chat_bubble),
- title: Text('Chats')),
- BottomNavigationBarItem(
- icon: Icon(Icons.settings),
- title: Text('Settings')),
- ],
- ),) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement