makeHomeGreatAgain #18
|
@ -1,7 +1,7 @@
|
||||||
[env]
|
[env]
|
||||||
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
||||||
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["native/dubp_rs"]
|
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["native/dubp_rs"]
|
||||||
ANDROID_PLATFORM_VERSION = "22"
|
ANDROID_PLATFORM_VERSION = "21"
|
||||||
TARGET_OS = "unknown"
|
TARGET_OS = "unknown"
|
||||||
RELEASE = true
|
RELEASE = true
|
||||||
DEV = false
|
DEV = false
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
|
@ -1,4 +1,4 @@
|
||||||
import 'package:dubp/dubp.dart';
|
import 'dart:async';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/cesiumPlus.dart';
|
import 'package:gecko/models/cesiumPlus.dart';
|
||||||
import 'package:gecko/models/changePin.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:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:catcher/catcher.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;
|
final bool enableSentry = true;
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
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();
|
HomeProvider _homeProvider = HomeProvider();
|
||||||
await _homeProvider.getAppPath();
|
await _homeProvider.getAppPath();
|
||||||
await _homeProvider.createDefaultAvatar();
|
await _homeProvider.createDefaultAvatar();
|
||||||
|
@ -55,23 +34,33 @@ Future<void> main() async {
|
||||||
endPointGVA = await _homeProvider.getValidEndpoint();
|
endPointGVA = await _homeProvider.getValidEndpoint();
|
||||||
|
|
||||||
if (kReleaseMode && enableSentry) {
|
if (kReleaseMode && enableSentry) {
|
||||||
CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
|
// CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
|
||||||
SentryHandler(SentryClient(SentryOptions(
|
// SentryHandler(SentryClient(SentryOptions(
|
||||||
dsn:
|
// dsn:
|
||||||
"https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110")))
|
// "https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110")))
|
||||||
]);
|
|
||||||
// CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [
|
|
||||||
// EmailManualHandler(["poka@p2p.legal"])
|
|
||||||
// ]);
|
// ]);
|
||||||
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(
|
await SentryFlutter.init((options) {
|
||||||
// (options) {
|
options.dsn =
|
||||||
// options.dsn =
|
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||||
// 'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
}, appRunner: () => runApp(Gecko(endPointGVA, _store)));
|
||||||
// },
|
|
||||||
// appRunner: () => runApp(Gecko(endPointGVA, _store)),
|
// runZoned<Future<void>>(
|
||||||
// );
|
// () async {
|
||||||
|
// runApp(Gecko(endPointGVA, _store));
|
||||||
|
// },
|
||||||
|
// onError: (dynamic error, StackTrace stackTrace) {
|
||||||
|
// print("=================== CAUGHT DART ERROR");
|
||||||
|
// // Sentry.captureException(
|
||||||
|
// // error,
|
||||||
|
// // stackTrace: stackTrace,
|
||||||
|
// // );
|
||||||
|
// },
|
||||||
|
// ));
|
||||||
} else {
|
} else {
|
||||||
print('Debug mode enabled: No sentry alerte');
|
print('Debug mode enabled: No sentry alerte');
|
||||||
|
|
||||||
|
@ -96,18 +85,9 @@ class Gecko extends StatelessWidget {
|
||||||
link: _httpLink,
|
link: _httpLink,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
try {
|
|
||||||
DubpRust.setup();
|
|
||||||
} catch (e, stack) {
|
|
||||||
print(e);
|
|
||||||
if (kReleaseMode) {
|
|
||||||
Sentry.captureException(
|
|
||||||
e,
|
|
||||||
stackTrace: stack,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
// HistoryProvider('').snackNode(context);
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
// Provider(create: (context) => HistoryProvider()),
|
// Provider(create: (context) => HistoryProvider()),
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/home.dart';
|
import 'package:gecko/models/home.dart';
|
||||||
|
import 'package:gecko/screens/history.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
@ -64,6 +65,12 @@ class HistoryProvider with ChangeNotifier {
|
||||||
isHistoryScreen = false;
|
isHistoryScreen = false;
|
||||||
historySwitchButtun = "Voir l'historique";
|
historySwitchButtun = "Voir l'historique";
|
||||||
_homeProvider.handleSearchEnd();
|
_homeProvider.handleSearchEnd();
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return HistoryScreen();
|
||||||
|
}),
|
||||||
|
);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
return pubkey;
|
return pubkey;
|
||||||
|
@ -202,8 +209,8 @@ class HistoryProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
final snackBar =
|
final snackBar =
|
||||||
SnackBar(content: Text(_message), duration: Duration(seconds: 2));
|
SnackBar(content: Text(_message), duration: Duration(seconds: 2));
|
||||||
Scaffold.of(context).showSnackBar(snackBar);
|
|
||||||
isFirstBuild = false;
|
isFirstBuild = false;
|
||||||
|
Scaffold.of(context).showSnackBar(snackBar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ class HomeProvider with ChangeNotifier {
|
||||||
Icon searchIcon = Icon(Icons.search);
|
Icon searchIcon = Icon(Icons.search);
|
||||||
final TextEditingController searchQuery = new TextEditingController();
|
final TextEditingController searchQuery = new TextEditingController();
|
||||||
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
|
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
|
||||||
|
Widget appBarExplorer =
|
||||||
|
Text('Explorateur', style: TextStyle(color: Colors.grey[850]));
|
||||||
|
|
||||||
List currentTab = [HistoryScreen(), WalletsHome()];
|
List currentTab = [HistoryScreen(), WalletsHome()];
|
||||||
|
|
||||||
get currentIndex => _currentIndex;
|
get currentIndex => _currentIndex;
|
||||||
|
@ -124,6 +127,8 @@ class HomeProvider with ChangeNotifier {
|
||||||
color: Colors.grey[850],
|
color: Colors.grey[850],
|
||||||
);
|
);
|
||||||
appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
|
appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
|
||||||
|
appBarExplorer =
|
||||||
|
Text('Explorateur', style: TextStyle(color: Colors.grey[850]));
|
||||||
isSearching = false;
|
isSearching = false;
|
||||||
searchQuery.clear();
|
searchQuery.clear();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:io';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/cesiumPlus.dart';
|
import 'package:gecko/models/cesiumPlus.dart';
|
||||||
|
import 'package:gecko/models/home.dart';
|
||||||
import 'package:gecko/models/queries.dart';
|
import 'package:gecko/models/queries.dart';
|
||||||
import 'package:gecko/models/history.dart';
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -28,14 +29,55 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||||
this._outputPubkey.text = _historyProvider.pubkey;
|
this._outputPubkey.text = _historyProvider.pubkey;
|
||||||
print('Build pubkey : ' + _historyProvider.pubkey);
|
print('Build pubkey : ' + _historyProvider.pubkey);
|
||||||
// _historyProvider.snackNode(context);
|
// _historyProvider.snackNode(context);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
||||||
_historyProvider.snackNode(context);
|
|
||||||
});
|
|
||||||
|
|
||||||
return Scaffold(
|
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(
|
floatingActionButton: Container(
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
width: 80.0,
|
width: 80.0,
|
||||||
|
@ -120,128 +162,139 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
|
|
||||||
// Build history list
|
// Build history list
|
||||||
return NotificationListener(
|
return NotificationListener(
|
||||||
child: Expanded(
|
child: Builder(
|
||||||
child: ListView(
|
builder: (context) => Expanded(
|
||||||
controller: scrollController,
|
child: ListView(
|
||||||
children: <Widget>[
|
controller: scrollController,
|
||||||
SizedBox(height: 20),
|
children: <Widget>[
|
||||||
if (_historyProvider.pubkey != '')
|
SizedBox(height: 20),
|
||||||
Row(
|
if (_historyProvider.pubkey != '')
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisAlignment:
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
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<List> _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)
|
if (_isFirstExec)
|
||||||
Container(
|
Container(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.fromLTRB(12, 0, 5, 0),
|
const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||||
child: FutureBuilder(
|
child: Text(balance.toString() + ' Ğ1',
|
||||||
future: _cesiumPlusProvider
|
textAlign: TextAlign.center,
|
||||||
.getAvatar(_historyProvider.pubkey),
|
style: TextStyle(fontSize: 18.0))),
|
||||||
initialData: [
|
SizedBox(height: 20),
|
||||||
File(appPath.path +
|
ElevatedButton(
|
||||||
'/default_avatar.png')
|
style: ElevatedButton.styleFrom(
|
||||||
],
|
elevation: 1,
|
||||||
builder: (BuildContext context,
|
primary: Colors.grey[50], // background
|
||||||
AsyncSnapshot<List> _avatar) {
|
onPrimary: Colors.black, // foreground
|
||||||
cesiumData = _avatar.data;
|
),
|
||||||
// _cesiumPlusProvider.isComplete = true;
|
onPressed: () {
|
||||||
if (_avatar.connectionState !=
|
_historyProvider.switchProfileView();
|
||||||
ConnectionState.done) {
|
},
|
||||||
return Image.file(
|
child: Text(
|
||||||
File(appPath.path +
|
_historyProvider.historySwitchButtun,
|
||||||
'/default_avatar.png'),
|
style: TextStyle(
|
||||||
height: avatarsSize);
|
fontSize: 15,
|
||||||
}
|
color: Color(0xffD28928)))),
|
||||||
if (_avatar.hasError) {
|
// const Divider(
|
||||||
return Image.file(
|
// color: Colors.grey,
|
||||||
File(appPath.path +
|
// height: 5,
|
||||||
'/default_avatar.png'),
|
// thickness: 0.5,
|
||||||
height: avatarsSize);
|
// indent: 0,
|
||||||
}
|
// endIndent: 0,
|
||||||
if (_avatar.hasData) {
|
// ),
|
||||||
return SingleChildScrollView(
|
_historyProvider.isHistoryScreen
|
||||||
padding: EdgeInsets.all(0.0),
|
? historyView(context, result)
|
||||||
child: Image.file(_avatar.data[0],
|
: payView(context),
|
||||||
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),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
onNotification: (t) {
|
onNotification: (t) {
|
||||||
if (t is ScrollEndNotification &&
|
if (t is ScrollEndNotification &&
|
||||||
scrollController.position.pixels >=
|
scrollController.position.pixels >=
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/history.dart';
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:gecko/models/home.dart';
|
import 'package:gecko/models/home.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/screens/myWallets/walletsHome.dart';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:gecko/screens/settings.dart';
|
import 'package:gecko/screens/settings.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
@ -11,128 +13,314 @@ class HomeScreen extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
HistoryProvider _historyStatic = HistoryProvider('');
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
drawer: Drawer(
|
resizeToAvoidBottomInset: false,
|
||||||
child: Column(
|
drawer: Drawer(
|
||||||
children: <Widget>[
|
child: Column(
|
||||||
Expanded(
|
children: <Widget>[
|
||||||
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
Expanded(
|
||||||
DrawerHeader(
|
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
||||||
child: Column(children: <Widget>[
|
DrawerHeader(
|
||||||
SizedBox(height: 0),
|
child: Column(children: <Widget>[
|
||||||
Image(
|
SizedBox(height: 0),
|
||||||
image: AssetImage('assets/icon/gecko_final.png'),
|
Image(
|
||||||
height: 130),
|
image: AssetImage('assets/icon/gecko_final.png'),
|
||||||
]),
|
height: 130),
|
||||||
decoration: BoxDecoration(
|
]),
|
||||||
color: Color(0xffD28928),
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xffD28928),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
ListTile(
|
||||||
ListTile(
|
title: Text('Paramètres'),
|
||||||
title: Text('Paramètres'),
|
onTap: () {
|
||||||
onTap: () {
|
Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
Navigator.push(
|
||||||
Navigator.push(
|
context,
|
||||||
context,
|
MaterialPageRoute(builder: (context) {
|
||||||
MaterialPageRoute(builder: (context) {
|
return SettingsScreen();
|
||||||
return SettingsScreen();
|
}),
|
||||||
}),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
ListTile(
|
||||||
ListTile(
|
title: Text('A propos'),
|
||||||
title: Text('A propos'),
|
onTap: () {
|
||||||
onTap: () {
|
// Update the state of the app.
|
||||||
// Update the state of the app.
|
// ...
|
||||||
// ...
|
},
|
||||||
},
|
),
|
||||||
),
|
])),
|
||||||
])),
|
Container(
|
||||||
Container(
|
child: Align(
|
||||||
child: Align(
|
alignment: FractionalOffset.bottomCenter,
|
||||||
alignment: FractionalOffset.bottomCenter,
|
child: Text('Ğecko v$appVersion'))),
|
||||||
child: Text('Ğecko v$appVersion'))),
|
SizedBox(height: 20)
|
||||||
SizedBox(height: 20)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
appBar: AppBar(
|
||||||
appBar: AppBar(
|
leading: Builder(
|
||||||
leading: Builder(
|
builder: (context) => IconButton(
|
||||||
builder: (context) => IconButton(
|
icon: new Icon(Icons.menu, color: Colors.grey[850]),
|
||||||
icon: new Icon(Icons.menu, color: Colors.grey[850]),
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
||||||
onPressed: () => Scaffold.of(context).openDrawer(),
|
)),
|
||||||
)),
|
title: _homeProvider.appBarTitle,
|
||||||
title: _homeProvider.appBarTitle,
|
actions: [
|
||||||
actions: [
|
Padding(
|
||||||
Padding(
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
child: IconButton(
|
||||||
child: IconButton(
|
icon: _homeProvider.searchIcon,
|
||||||
icon: _homeProvider.searchIcon,
|
color: Colors.grey[850],
|
||||||
color: Colors.grey[850],
|
onPressed: () {
|
||||||
onPressed: () {
|
if (_homeProvider.searchIcon.icon == Icons.search) {
|
||||||
// Navigator.push(
|
_homeProvider.searchIcon = Icon(
|
||||||
// context,
|
Icons.close,
|
||||||
// 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(
|
|
||||||
color: Colors.grey[850],
|
color: Colors.grey[850],
|
||||||
),
|
);
|
||||||
decoration: InputDecoration(
|
_homeProvider.appBarTitle = TextField(
|
||||||
prefixIcon:
|
autofocus: true,
|
||||||
Icon(Icons.search, color: Colors.grey[850]),
|
controller: _homeProvider.searchQuery,
|
||||||
hintText: "Rechercher ...",
|
onChanged: (text) {
|
||||||
hintStyle: TextStyle(color: Colors.grey[850])),
|
print("Clé tappé: $text");
|
||||||
);
|
final String searchResult =
|
||||||
_homeProvider.handleSearchStart();
|
_historyProvider.isPubkey(context, text);
|
||||||
} else {
|
if (searchResult != '') {
|
||||||
_homeProvider.handleSearchEnd();
|
_homeProvider.currentIndex = 0;
|
||||||
}
|
}
|
||||||
}))
|
},
|
||||||
],
|
style: TextStyle(
|
||||||
backgroundColor: Color(0xffFFD58D),
|
color: Colors.grey[850],
|
||||||
),
|
),
|
||||||
backgroundColor: Color(0xffF9F9F1),
|
decoration: InputDecoration(
|
||||||
body: _homeProvider.currentTab[_homeProvider.currentIndex],
|
prefixIcon:
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
Icon(Icons.search, color: Colors.grey[850]),
|
||||||
backgroundColor: Color(0xffFFD58D),
|
hintText: "Rechercher ...",
|
||||||
fixedColor: Colors.grey[850],
|
hintStyle: TextStyle(color: Colors.grey[850])),
|
||||||
unselectedItemColor: Color(0xffBD935C),
|
);
|
||||||
type: BottomNavigationBarType.fixed,
|
_homeProvider.handleSearchStart();
|
||||||
onTap: (index) {
|
} else {
|
||||||
_homeProvider.currentIndex = index;
|
_homeProvider.handleSearchEnd();
|
||||||
},
|
}
|
||||||
currentIndex: _homeProvider.currentIndex,
|
}))
|
||||||
items: [
|
],
|
||||||
BottomNavigationBarItem(
|
backgroundColor: Color(0xffFFD58D),
|
||||||
icon: Image.asset('assets/block-space-disabled.png', height: 26),
|
),
|
||||||
activeIcon: Image.asset('assets/blockchain.png', height: 26),
|
backgroundColor: Color(0xffF9F9F1),
|
||||||
label: 'Explorateur',
|
body: Builder(
|
||||||
),
|
builder: (ctx) => StatefulWrapper(
|
||||||
BottomNavigationBarItem(
|
onInit: () {
|
||||||
icon: Icon(Icons.lock),
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
label: 'Mes portefeuilles',
|
DubpRust.setup();
|
||||||
),
|
_historyStatic.snackNode(ctx);
|
||||||
],
|
});
|
||||||
),
|
},
|
||||||
);
|
child: Column(children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(top: 22),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
Column(children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
Column(children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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<StatefulWrapper> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
if (widget.onInit != null) {
|
||||||
|
widget.onInit();
|
||||||
|
}
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return widget.child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,11 @@ class WalletsHome extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('Mes portefeuilles',
|
||||||
|
style: TextStyle(color: Colors.grey[850])),
|
||||||
|
backgroundColor: Color(0xffFFD58D),
|
||||||
|
),
|
||||||
floatingActionButton: Visibility(
|
floatingActionButton: Visibility(
|
||||||
visible: (isWalletsExists && firstWalletDerivation != -1),
|
visible: (isWalletsExists && firstWalletDerivation != -1),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: A new Flutter project.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# 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
|
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:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
@ -64,4 +64,5 @@ flutter:
|
||||||
- assets/blockchain.png
|
- assets/blockchain.png
|
||||||
- assets/block-space.png
|
- assets/block-space.png
|
||||||
- assets/block-space-disabled.png
|
- assets/block-space-disabled.png
|
||||||
|
- assets/lock.png
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue