diff --git a/Makefile.toml b/Makefile.toml index c468104..df6d1a7 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,7 +1,7 @@ [env] CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["native/dubp_rs"] -ANDROID_PLATFORM_VERSION = "22" +ANDROID_PLATFORM_VERSION = "21" TARGET_OS = "unknown" RELEASE = true DEV = false diff --git a/assets/lock.png b/assets/lock.png new file mode 100644 index 0000000..b6f1c56 Binary files /dev/null and b/assets/lock.png differ diff --git a/lib/main.dart b/lib/main.dart index 7efdea8..0b3fdc6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,4 @@ -import 'package:dubp/dubp.dart'; +import 'dart:async'; import 'package:gecko/globals.dart'; import 'package:gecko/models/cesiumPlus.dart'; import 'package:gecko/models/changePin.dart'; @@ -17,32 +17,11 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:catcher/catcher.dart'; -// import 'dart:io'; -// import 'package:flutter_logs/flutter_logs.dart'; -// import 'package:downloads_path_provider/downloads_path_provider.dart'; - final bool enableSentry = true; Future main() async { WidgetsFlutterBinding.ensureInitialized(); - // var downloadsDirectory = DownloadsPathProvider.downloadsDirectory; - // File logFile = File(downloadsDirectory.toString() + '/gecko.log'); - - // await FlutterLogs.initLogs( - // logLevelsEnabled: [ - // LogLevel.INFO, - // LogLevel.WARNING, - // LogLevel.ERROR, - // LogLevel.SEVERE - // ], - // timeStampFormat: TimeStampFormat.TIME_FORMAT_READABLE, - // directoryStructure: DirectoryStructure.FOR_EVENT, - // logTypesEnabled: ["Locations", "APIs"], - // logFileExtension: LogFileExtension.LOG, - // logsWriteDirectoryName: downloadsDirectory.toString(), - // logsExportDirectoryName: downloadsDirectory.toString()); - HomeProvider _homeProvider = HomeProvider(); await _homeProvider.getAppPath(); await _homeProvider.createDefaultAvatar(); @@ -55,23 +34,33 @@ Future main() async { endPointGVA = await _homeProvider.getValidEndpoint(); if (kReleaseMode && enableSentry) { - CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [ - SentryHandler(SentryClient(SentryOptions( - dsn: - "https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110"))) - ]); - // CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [ - // EmailManualHandler(["poka@p2p.legal"]) + // CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [ + // SentryHandler(SentryClient(SentryOptions( + // dsn: + // "https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110"))) // ]); - Catcher(rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions); + // // CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [ + // // EmailManualHandler(["poka@p2p.legal"]) + // // ]); + // Catcher(rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions); - // await SentryFlutter.init( - // (options) { - // options.dsn = - // 'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110'; - // }, - // appRunner: () => runApp(Gecko(endPointGVA, _store)), - // ); + await SentryFlutter.init((options) { + options.dsn = + 'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110'; + }, appRunner: () => runApp(Gecko(endPointGVA, _store))); + + // runZoned>( + // () async { + // runApp(Gecko(endPointGVA, _store)); + // }, + // onError: (dynamic error, StackTrace stackTrace) { + // print("=================== CAUGHT DART ERROR"); + // // Sentry.captureException( + // // error, + // // stackTrace: stackTrace, + // // ); + // }, + // )); } else { print('Debug mode enabled: No sentry alerte'); @@ -96,18 +85,9 @@ class Gecko extends StatelessWidget { link: _httpLink, ), ); - try { - DubpRust.setup(); - } catch (e, stack) { - print(e); - if (kReleaseMode) { - Sentry.captureException( - e, - stackTrace: stack, - ); - } - } + // HistoryProvider _historyProvider = Provider.of(context); + // HistoryProvider('').snackNode(context); return MultiProvider( providers: [ // Provider(create: (context) => HistoryProvider()), diff --git a/lib/models/history.dart b/lib/models/history.dart index 966d14c..0585c29 100644 --- a/lib/models/history.dart +++ b/lib/models/history.dart @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/home.dart'; +import 'package:gecko/screens/history.dart'; import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; @@ -64,6 +65,12 @@ class HistoryProvider with ChangeNotifier { isHistoryScreen = false; historySwitchButtun = "Voir l'historique"; _homeProvider.handleSearchEnd(); + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return HistoryScreen(); + }), + ); notifyListeners(); return pubkey; @@ -202,8 +209,8 @@ class HistoryProvider with ChangeNotifier { } final snackBar = SnackBar(content: Text(_message), duration: Duration(seconds: 2)); - Scaffold.of(context).showSnackBar(snackBar); isFirstBuild = false; + Scaffold.of(context).showSnackBar(snackBar); } } diff --git a/lib/models/home.dart b/lib/models/home.dart index c8eeeca..afacee6 100644 --- a/lib/models/home.dart +++ b/lib/models/home.dart @@ -17,6 +17,9 @@ class HomeProvider with ChangeNotifier { Icon searchIcon = Icon(Icons.search); final TextEditingController searchQuery = new TextEditingController(); Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850])); + Widget appBarExplorer = + Text('Explorateur', style: TextStyle(color: Colors.grey[850])); + List currentTab = [HistoryScreen(), WalletsHome()]; get currentIndex => _currentIndex; @@ -124,6 +127,8 @@ class HomeProvider with ChangeNotifier { color: Colors.grey[850], ); appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850])); + appBarExplorer = + Text('Explorateur', style: TextStyle(color: Colors.grey[850])); isSearching = false; searchQuery.clear(); diff --git a/lib/screens/history.dart b/lib/screens/history.dart index 8a41aa5..e9ec8cb 100644 --- a/lib/screens/history.dart +++ b/lib/screens/history.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/cesiumPlus.dart'; +import 'package:gecko/models/home.dart'; import 'package:gecko/models/queries.dart'; import 'package:gecko/models/history.dart'; import 'package:flutter/material.dart'; @@ -28,14 +29,55 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier { @override Widget build(BuildContext context) { HistoryProvider _historyProvider = Provider.of(context); + HomeProvider _homeProvider = Provider.of(context); this._outputPubkey.text = _historyProvider.pubkey; print('Build pubkey : ' + _historyProvider.pubkey); // _historyProvider.snackNode(context); - WidgetsBinding.instance.addPostFrameCallback((_) { - _historyProvider.snackNode(context); - }); + WidgetsBinding.instance.addPostFrameCallback((_) {}); return Scaffold( + appBar: AppBar( + title: _homeProvider.appBarExplorer, + actions: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16), + child: IconButton( + icon: _homeProvider.searchIcon, + color: Colors.grey[850], + onPressed: () { + if (_homeProvider.searchIcon.icon == Icons.search) { + _homeProvider.searchIcon = Icon( + Icons.close, + color: Colors.grey[850], + ); + _homeProvider.appBarExplorer = TextField( + autofocus: true, + controller: _homeProvider.searchQuery, + onChanged: (text) { + print("Clé tappé: $text"); + final String searchResult = + _historyProvider.isPubkey(context, text); + if (searchResult != '') { + _homeProvider.currentIndex = 0; + } + }, + style: TextStyle( + color: Colors.grey[850], + ), + decoration: InputDecoration( + prefixIcon: + Icon(Icons.search, color: Colors.grey[850]), + hintText: "Rechercher ...", + hintStyle: TextStyle(color: Colors.grey[850])), + ); + _homeProvider.handleSearchStart(); + } else { + _homeProvider.handleSearchEnd(); + } + })) + ], + backgroundColor: Color(0xffFFD58D), + ), floatingActionButton: Container( height: 80.0, width: 80.0, @@ -120,128 +162,139 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier { // Build history list return NotificationListener( - child: Expanded( - child: ListView( - controller: scrollController, - children: [ - SizedBox(height: 20), - if (_historyProvider.pubkey != '') - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ + child: Builder( + builder: (context) => Expanded( + child: ListView( + controller: scrollController, + children: [ + SizedBox(height: 20), + if (_historyProvider.pubkey != '') + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (_isFirstExec) + Container( + padding: const EdgeInsets.fromLTRB( + 12, 0, 5, 0), + child: FutureBuilder( + future: + _cesiumPlusProvider.getAvatar( + _historyProvider.pubkey), + initialData: [ + File(appPath.path + + '/default_avatar.png') + ], + builder: (BuildContext context, + AsyncSnapshot _avatar) { + cesiumData = _avatar.data; + // _cesiumPlusProvider.isComplete = true; + if (_avatar.connectionState != + ConnectionState.done) { + return Image.file( + File(appPath.path + + '/default_avatar.png'), + height: avatarsSize); + } + if (_avatar.hasError) { + return Image.file( + File(appPath.path + + '/default_avatar.png'), + height: avatarsSize); + } + if (_avatar.hasData) { + return SingleChildScrollView( + padding: + EdgeInsets.all(0.0), + child: Image.file( + _avatar.data[0], + height: avatarsSize)); + } + return Image.file( + File(appPath.path + + '/default_avatar.png'), + height: avatarsSize); + })), + GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData( + text: _historyProvider.pubkey)); + _historyProvider.snackCopyKey(context); + }, + child: Text( + _historyProvider.getShortPubkey( + _historyProvider.pubkey), + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.w800, + fontFamily: 'Monospace')), + ), + Container( + padding: const EdgeInsets.fromLTRB( + 30, 0, 5, 0), // .only(right: 15), + child: Text('TODO')), + SizedBox(width: 0) + ]), + if (_isFirstExec) + Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + padding: const EdgeInsets.fromLTRB( + 0, 0, 0, 0), + // padding: const EdgeInsets., + child: FutureBuilder( + future: _cesiumPlusProvider.getName( + _historyProvider.pubkey), + initialData: '...', + builder: (context, snapshot) { + return Text( + snapshot.data != '' + ? snapshot.data + : '-', + style: + TextStyle(fontSize: 20)); + })) + ]), + SizedBox(height: 18), if (_isFirstExec) Container( padding: - const EdgeInsets.fromLTRB(12, 0, 5, 0), - child: FutureBuilder( - future: _cesiumPlusProvider - .getAvatar(_historyProvider.pubkey), - initialData: [ - File(appPath.path + - '/default_avatar.png') - ], - builder: (BuildContext context, - AsyncSnapshot _avatar) { - cesiumData = _avatar.data; - // _cesiumPlusProvider.isComplete = true; - if (_avatar.connectionState != - ConnectionState.done) { - return Image.file( - File(appPath.path + - '/default_avatar.png'), - height: avatarsSize); - } - if (_avatar.hasError) { - return Image.file( - File(appPath.path + - '/default_avatar.png'), - height: avatarsSize); - } - if (_avatar.hasData) { - return SingleChildScrollView( - padding: EdgeInsets.all(0.0), - child: Image.file(_avatar.data[0], - height: avatarsSize)); - } - return Image.file( - File(appPath.path + - '/default_avatar.png'), - height: avatarsSize); - })), - GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData( - text: _historyProvider.pubkey)); - _historyProvider.snackCopyKey(context); - }, - child: Text( - _historyProvider - .getShortPubkey(_historyProvider.pubkey), - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.w800, - fontFamily: 'Monospace')), - ), - Container( - padding: const EdgeInsets.fromLTRB( - 30, 0, 5, 0), // .only(right: 15), - child: Text('TODO')), - SizedBox(width: 0) - ]), - if (_isFirstExec) - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - // padding: const EdgeInsets., - child: FutureBuilder( - future: _cesiumPlusProvider - .getName(_historyProvider.pubkey), - initialData: '...', - builder: (context, snapshot) { - return Text( - snapshot.data != '' - ? snapshot.data - : '-', - style: TextStyle(fontSize: 20)); - })) - ]), - SizedBox(height: 18), - if (_isFirstExec) - Container( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - child: Text(balance.toString() + ' Ğ1', - textAlign: TextAlign.center, - style: TextStyle(fontSize: 18.0))), - SizedBox(height: 20), - ElevatedButton( - style: ElevatedButton.styleFrom( - elevation: 1, - primary: Colors.grey[50], // background - onPrimary: Colors.black, // foreground - ), - onPressed: () { - _historyProvider.switchProfileView(); - }, - child: Text(_historyProvider.historySwitchButtun, - style: TextStyle( - fontSize: 15, color: Color(0xffD28928)))), - // const Divider( - // color: Colors.grey, - // height: 5, - // thickness: 0.5, - // indent: 0, - // endIndent: 0, - // ), - _historyProvider.isHistoryScreen - ? historyView(context, result) - : payView(context), - ], - )), + const EdgeInsets.fromLTRB(0, 0, 0, 0), + child: Text(balance.toString() + ' Ğ1', + textAlign: TextAlign.center, + style: TextStyle(fontSize: 18.0))), + SizedBox(height: 20), + ElevatedButton( + style: ElevatedButton.styleFrom( + elevation: 1, + primary: Colors.grey[50], // background + onPrimary: Colors.black, // foreground + ), + onPressed: () { + _historyProvider.switchProfileView(); + }, + child: Text( + _historyProvider.historySwitchButtun, + style: TextStyle( + fontSize: 15, + color: Color(0xffD28928)))), + // const Divider( + // color: Colors.grey, + // height: 5, + // thickness: 0.5, + // indent: 0, + // endIndent: 0, + // ), + _historyProvider.isHistoryScreen + ? historyView(context, result) + : payView(context), + ], + ))), onNotification: (t) { if (t is ScrollEndNotification && scrollController.position.pixels >= diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 0c71e28..54afc88 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -1,7 +1,9 @@ +import 'package:dubp/dubp.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/history.dart'; import 'package:gecko/models/home.dart'; import 'package:flutter/material.dart'; +import 'package:gecko/screens/myWallets/walletsHome.dart'; import 'dart:ui'; import 'package:gecko/screens/settings.dart'; import 'package:provider/provider.dart'; @@ -11,128 +13,314 @@ class HomeScreen extends StatelessWidget { Widget build(BuildContext context) { HomeProvider _homeProvider = Provider.of(context); HistoryProvider _historyProvider = Provider.of(context); + HistoryProvider _historyStatic = HistoryProvider(''); return Scaffold( - drawer: Drawer( - child: Column( - children: [ - Expanded( - child: ListView(padding: EdgeInsets.zero, children: [ - DrawerHeader( - child: Column(children: [ - SizedBox(height: 0), - Image( - image: AssetImage('assets/icon/gecko_final.png'), - height: 130), - ]), - decoration: BoxDecoration( - color: Color(0xffD28928), + resizeToAvoidBottomInset: false, + drawer: Drawer( + child: Column( + children: [ + Expanded( + child: ListView(padding: EdgeInsets.zero, children: [ + DrawerHeader( + child: Column(children: [ + SizedBox(height: 0), + Image( + image: AssetImage('assets/icon/gecko_final.png'), + height: 130), + ]), + decoration: BoxDecoration( + color: Color(0xffD28928), + ), ), - ), - ListTile( - title: Text('Paramètres'), - onTap: () { - Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute(builder: (context) { - return SettingsScreen(); - }), - ); - }, - ), - ListTile( - title: Text('A propos'), - onTap: () { - // Update the state of the app. - // ... - }, - ), - ])), - Container( - child: Align( - alignment: FractionalOffset.bottomCenter, - child: Text('Ğecko v$appVersion'))), - SizedBox(height: 20) - ], + ListTile( + title: Text('Paramètres'), + onTap: () { + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return SettingsScreen(); + }), + ); + }, + ), + ListTile( + title: Text('A propos'), + onTap: () { + // Update the state of the app. + // ... + }, + ), + ])), + Container( + child: Align( + alignment: FractionalOffset.bottomCenter, + child: Text('Ğecko v$appVersion'))), + SizedBox(height: 20) + ], + ), ), - ), - appBar: AppBar( - leading: Builder( - builder: (context) => IconButton( - icon: new Icon(Icons.menu, color: Colors.grey[850]), - onPressed: () => Scaffold.of(context).openDrawer(), - )), - title: _homeProvider.appBarTitle, - actions: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16), - child: IconButton( - icon: _homeProvider.searchIcon, - color: Colors.grey[850], - onPressed: () { - // Navigator.push( - // context, - // MaterialPageRoute(builder: (context) { - // return SearchList(); - // }), - // ); - - if (_homeProvider.searchIcon.icon == Icons.search) { - _homeProvider.searchIcon = Icon( - Icons.close, - color: Colors.grey[850], - ); - _homeProvider.appBarTitle = TextField( - autofocus: true, - controller: _homeProvider.searchQuery, - onChanged: (text) { - print("Clé tappé: $text"); - final String searchResult = - _historyProvider.isPubkey(context, text); - if (searchResult != '') { - _homeProvider.currentIndex = 0; - } - }, - style: TextStyle( + appBar: AppBar( + leading: Builder( + builder: (context) => IconButton( + icon: new Icon(Icons.menu, color: Colors.grey[850]), + onPressed: () => Scaffold.of(context).openDrawer(), + )), + title: _homeProvider.appBarTitle, + actions: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16), + child: IconButton( + icon: _homeProvider.searchIcon, + color: Colors.grey[850], + onPressed: () { + if (_homeProvider.searchIcon.icon == Icons.search) { + _homeProvider.searchIcon = Icon( + Icons.close, color: Colors.grey[850], - ), - decoration: InputDecoration( - prefixIcon: - Icon(Icons.search, color: Colors.grey[850]), - hintText: "Rechercher ...", - hintStyle: TextStyle(color: Colors.grey[850])), - ); - _homeProvider.handleSearchStart(); - } else { - _homeProvider.handleSearchEnd(); - } - })) - ], - backgroundColor: Color(0xffFFD58D), - ), - backgroundColor: Color(0xffF9F9F1), - body: _homeProvider.currentTab[_homeProvider.currentIndex], - bottomNavigationBar: BottomNavigationBar( - backgroundColor: Color(0xffFFD58D), - fixedColor: Colors.grey[850], - unselectedItemColor: Color(0xffBD935C), - type: BottomNavigationBarType.fixed, - onTap: (index) { - _homeProvider.currentIndex = index; - }, - currentIndex: _homeProvider.currentIndex, - items: [ - BottomNavigationBarItem( - icon: Image.asset('assets/block-space-disabled.png', height: 26), - activeIcon: Image.asset('assets/blockchain.png', height: 26), - label: 'Explorateur', - ), - BottomNavigationBarItem( - icon: Icon(Icons.lock), - label: 'Mes portefeuilles', - ), - ], - ), - ); + ); + _homeProvider.appBarTitle = TextField( + autofocus: true, + controller: _homeProvider.searchQuery, + onChanged: (text) { + print("Clé tappé: $text"); + final String searchResult = + _historyProvider.isPubkey(context, text); + if (searchResult != '') { + _homeProvider.currentIndex = 0; + } + }, + style: TextStyle( + color: Colors.grey[850], + ), + decoration: InputDecoration( + prefixIcon: + Icon(Icons.search, color: Colors.grey[850]), + hintText: "Rechercher ...", + hintStyle: TextStyle(color: Colors.grey[850])), + ); + _homeProvider.handleSearchStart(); + } else { + _homeProvider.handleSearchEnd(); + } + })) + ], + backgroundColor: Color(0xffFFD58D), + ), + backgroundColor: Color(0xffF9F9F1), + body: Builder( + builder: (ctx) => StatefulWrapper( + onInit: () { + WidgetsBinding.instance.addPostFrameCallback((_) { + DubpRust.setup(); + _historyStatic.snackNode(ctx); + }); + }, + child: Column(children: [ + Padding( + padding: EdgeInsets.only(top: 22), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(width: 7), + Image( + image: + AssetImage('assets/icon/gecko_final.png'), + height: 160), + ])), + Padding( + padding: EdgeInsets.only(top: 12), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "L’application de paiement Ğ1\nplus mobile qu’un lésard du Vietnam", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, fontSize: 15), + ) + ])), + Padding( + padding: EdgeInsets.only(top: 40), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column(children: [ + Container( + child: ClipOval( + child: Material( + color: Color(0xffFFD58D), // button color + child: InkWell( + splashColor: Color( + 0xffD28928), // inkwell color + child: Padding( + padding: EdgeInsets.all(17), + child: Image( + image: AssetImage( + 'assets/qrcode-scan.png'), + height: 50)), + onTap: () async { + await _historyProvider + .scan(context); + }), + ), + ), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.grey, + blurRadius: 4.0, + offset: Offset(2.0, 2.5), + spreadRadius: 0.5) + ], + ), + ), + SizedBox(height: 10), + Text( + "Payer par QR-Code", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, fontSize: 13), + ) + ]) + ])), + Padding( + padding: EdgeInsets.only(top: 40), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column(children: [ + Container( + child: ClipOval( + child: Material( + color: Color(0xffFFD58D), // button color + child: InkWell( + splashColor: Color( + 0xffD28928), // inkwell color + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 18, vertical: 14), + child: Image( + image: AssetImage( + 'assets/blockchain.png'), + height: 55)), + onTap: () {}), + ), + ), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.grey, + blurRadius: 4.0, + offset: Offset(2.0, 2.5), + spreadRadius: 0.5) + ], + ), + ), + SizedBox(height: 10), + Text( + "Explorer\n", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, fontSize: 13), + ) + ]), + SizedBox(width: 100), + Column(children: [ + Container( + child: ClipOval( + child: Material( + color: Color(0xffFFD58D), // button color + child: InkWell( + splashColor: Color( + 0xffD28928), // inkwell color + child: Padding( + padding: EdgeInsets.all(20), + child: Image( + image: AssetImage( + 'assets/lock.png'), + height: 45)), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return WalletsHome(); + }), + ); + }), + ), + ), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.grey, + blurRadius: 4.0, + offset: Offset(2.0, 2.5), + spreadRadius: 0.5) + ], + ), + ), + SizedBox(height: 10), + Text( + "Gérer mes\nportefeuilles", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, fontSize: 13), + ) + ]) + ])) + ]), + // bottomNavigationBar: BottomNavigationBar( + // backgroundColor: Color(0xffFFD58D), + // fixedColor: Colors.grey[850], + // unselectedItemColor: Color(0xffBD935C), + // type: BottomNavigationBarType.fixed, + // onTap: (index) { + // _homeProvider.currentIndex = index; + // }, + // currentIndex: _homeProvider.currentIndex, + // items: [ + // BottomNavigationBarItem( + // icon: Image.asset('assets/block-space-disabled.png', height: 26), + // activeIcon: Image.asset('assets/blockchain.png', height: 26), + // label: 'Explorateur', + // ), + // BottomNavigationBarItem( + // icon: Icon(Icons.lock), + // label: 'Mes portefeuilles', + // ), + // ], + // ), + ))); + } +} + +class StatefulWrapper extends StatefulWidget { + final Function onInit; + final Widget child; + const StatefulWrapper({@required this.onInit, @required this.child}); + @override + _StatefulWrapperState createState() => _StatefulWrapperState(); +} + +class _StatefulWrapperState extends State { + @override + void initState() { + if (widget.onInit != null) { + widget.onInit(); + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + return widget.child; } } diff --git a/lib/screens/myWallets/walletsHome.dart b/lib/screens/myWallets/walletsHome.dart index 9ea2c06..a9611a1 100644 --- a/lib/screens/myWallets/walletsHome.dart +++ b/lib/screens/myWallets/walletsHome.dart @@ -27,6 +27,11 @@ class WalletsHome extends StatelessWidget { } return Scaffold( + appBar: AppBar( + title: Text('Mes portefeuilles', + style: TextStyle(color: Colors.grey[850])), + backgroundColor: Color(0xffFFD58D), + ), floatingActionButton: Visibility( visible: (isWalletsExists && firstWalletDerivation != -1), child: Container( diff --git a/pubspec.yaml b/pubspec.yaml index ce9ab7b..21961d8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: A new Flutter project. # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.0.1+11 +version: 0.0.1+17 environment: sdk: ">=2.7.0 <3.0.0" @@ -64,4 +64,5 @@ flutter: - assets/blockchain.png - assets/block-space.png - assets/block-space-disabled.png + - assets/lock.png