Skip to content
Snippets Groups Projects
home.dart 2.48 KiB
Newer Older
import 'package:gecko/ui/historyScreen.dart';
import 'package:gecko/ui/generateWallets.dart';
import 'dart:typed_data';
import 'dart:ui';

import 'myWallets.dart';

//ignore: must_be_immutable
class HomeScreen extends StatefulWidget {
  HomeScreen({this.screens});
  final List<Widget> screens;

  @override
poka's avatar
poka committed
  HomeScreenState createState() => HomeScreenState();
poka's avatar
poka committed
class HomeScreenState extends State<HomeScreen> {
  GlobalKey<HistoryScreenState> _keyHistory = GlobalKey();

poka's avatar
poka committed
  int currentIndex = 0;
  Widget currentScreen;

  void onTabTapped(int index) {
    setState(() {
poka's avatar
poka committed
      currentIndex = index;
    });
  }

  Uint8List bytes = Uint8List(0);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xffF9F9F1),
      body: SafeArea(
        child: IndexedStack(
poka's avatar
poka committed
          index: currentIndex,
          children: <Widget>[
            HistoryScreen(
              keyHistory: _keyHistory,
            ),
            GenerateWalletScreen(),
            MyWalletsScreen(),
          ],
        ),
      ),
      floatingActionButton: Container(
        height: 80.0,
        width: 80.0,
        child: FittedBox(
          child: FloatingActionButton(
poka's avatar
poka committed
            onPressed: () async {
              final resultScan = await _keyHistory.currentState.scan();
              print(resultScan);
              if (resultScan != 'false') {
                onTabTapped(0);
              }
            },
            child: Container(
                height: 40.0,
                width: 40.0,
                child: Image.asset('images/scanner.png')),
            backgroundColor: Color(
                0xffEFEFBF), //Color(0xffFFD68E), //Color.fromARGB(500, 204, 255, 255),
          ),
        ),
      ),
      bottomNavigationBar: BottomNavigationBar(
        backgroundColor: Color(0xffFFD68E),
        fixedColor: Color(0xff855F2D),
        unselectedItemColor: Color(0xffBD935C),
        type: BottomNavigationBarType.fixed,
        onTap: onTabTapped,
poka's avatar
poka committed
        currentIndex: currentIndex,
        items: [
          BottomNavigationBarItem(
            icon: new Icon(Icons.format_list_bulleted),
            label: 'Accueil',
          ),
          BottomNavigationBarItem(
            icon: new Icon(Icons.person_add_alt_1_rounded),
            label: 'Générer un wallet',
          ),
          BottomNavigationBarItem(
            icon: new Icon(Icons.lock),
            label: 'Mes wallets',