Apply linter

This commit is contained in:
poka 2021-11-14 19:21:20 +01:00
parent 44eaee89a7
commit 97f20bafe5
90 changed files with 3056 additions and 718 deletions

29
analysis_options.yaml Normal file
View File

@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -1,7 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/chestData.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -28,7 +28,7 @@ double ratio;
var log = Logger(); var log = Logger();
// Colors // Colors
Color orangeC = Color(0xffd07316); Color orangeC = const Color(0xffd07316);
Color yellowC = Color(0xffFFD68E); Color yellowC = const Color(0xffFFD68E);
Color floattingYellow = Color(0xffEFEFBF); Color floattingYellow = const Color(0xffEFEFBF);
Color backgroundColor = Color(0xFFF5F5F5); Color backgroundColor = const Color(0xFFF5F5F5);

View File

@ -13,22 +13,24 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
// ignore_for_file: avoid_print
import 'dart:async'; import 'dart:async';
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/cesium_plus.dart';
import 'package:gecko/models/changePin.dart'; import 'package:gecko/models/change_pin.dart';
import 'package:gecko/models/chestData.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.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:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:gecko/screens/home.dart'; import 'package:gecko/screens/home.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/walletsHome.dart'; import 'package:gecko/screens/myWallets/wallets_home.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
@ -38,7 +40,7 @@ import 'package:responsive_framework/responsive_framework.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter/sentry_flutter.dart';
final bool enableSentry = true; const bool enableSentry = true;
Future<void> main() async { Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -106,7 +108,7 @@ Future<void> main() async {
} }
class Gecko extends StatelessWidget { class Gecko extends StatelessWidget {
Gecko(this.randomEndpoint); const Gecko(this.randomEndpoint, {Key key}) : super(key: key);
final String randomEndpoint; final String randomEndpoint;
@override @override
@ -145,28 +147,28 @@ class Gecko extends StatelessWidget {
minWidth: 480, minWidth: 480,
defaultScale: true, defaultScale: true,
breakpoints: [ breakpoints: [
ResponsiveBreakpoint.resize(480, name: MOBILE), const ResponsiveBreakpoint.resize(480, name: MOBILE),
ResponsiveBreakpoint.autoScale(800, name: TABLET), const ResponsiveBreakpoint.autoScale(800, name: TABLET),
ResponsiveBreakpoint.resize(1000, name: DESKTOP), const ResponsiveBreakpoint.resize(1000, name: DESKTOP),
], ],
background: Container(color: backgroundColor)), background: Container(color: backgroundColor)),
title: 'Ğecko', title: 'Ğecko',
theme: ThemeData( theme: ThemeData(
appBarTheme: AppBarTheme( appBarTheme: const AppBarTheme(
color: const Color(0xffFFD58D), color: Color(0xffFFD58D),
foregroundColor: const Color(0xFF000000), foregroundColor: Color(0xFF000000),
), ),
primaryColor: Color(0xffFFD58D), primaryColor: const Color(0xffFFD58D),
textTheme: TextTheme( textTheme: const TextTheme(
bodyText1: TextStyle(), bodyText1: TextStyle(),
bodyText2: TextStyle(), bodyText2: TextStyle(),
).apply( ).apply(
bodyColor: Color(0xFF000000), bodyColor: const Color(0xFF000000),
), ),
colorScheme: ColorScheme.fromSwatch() colorScheme: ColorScheme.fromSwatch()
.copyWith(secondary: Colors.grey[850]), .copyWith(secondary: Colors.grey[850]),
), ),
home: HomeScreen(), home: const HomeScreen(),
initialRoute: "/", initialRoute: "/",
routes: { routes: {
'/mywallets': (context) => WalletsHome(), '/mywallets': (context) => WalletsHome(),

View File

@ -7,10 +7,6 @@ import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
class CesiumPlusProvider with ChangeNotifier { class CesiumPlusProvider with ChangeNotifier {
// String pubkey = '';
// CesiumPlusProvider(this.pubkey);
var decodedBytes;
var avatar64;
TextEditingController cesiumName = TextEditingController(); TextEditingController cesiumName = TextEditingController();
int iAvatar = 0; int iAvatar = 0;
bool isComplete = false; bool isComplete = false;

View File

@ -3,11 +3,11 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:async'; import 'dart:async';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chestData.dart'; import 'package:gecko/models/chest_data.dart';
class ChangePinProvider with ChangeNotifier { class ChangePinProvider with ChangeNotifier {
bool ischangedPin = false; bool ischangedPin = false;
TextEditingController newPin = new TextEditingController(); TextEditingController newPin = TextEditingController();
Future<NewWallet> get badWallet => null; Future<NewWallet> get badWallet => null;

View File

@ -1,6 +1,6 @@
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
part 'chestData.g.dart'; part 'chest_data.g.dart';
@HiveType(typeId: 1) @HiveType(typeId: 1)
class ChestData extends HiveObject { class ChestData extends HiveObject {
@ -29,6 +29,6 @@ class ChestData extends HiveObject {
@override @override
String toString() { String toString() {
return this.name; return name;
} }
} }

View File

@ -1,6 +1,6 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'chestData.dart'; part of 'chest_data.dart';
// ************************************************************************** // **************************************************************************
// TypeAdapterGenerator // TypeAdapterGenerator

View File

@ -5,8 +5,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chestData.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:pdf/pdf.dart'; import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw; import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
@ -100,7 +100,7 @@ class GenerateWalletsProvider with ChangeNotifier {
} }
int getRandomInt() { int getRandomInt() {
var rng = new Random(); var rng = Random();
return rng.nextInt(12); return rng.nextInt(12);
} }
@ -131,7 +131,7 @@ class GenerateWalletsProvider with ChangeNotifier {
Future<String> generateMnemonic() async { Future<String> generateMnemonic() async {
try { try {
generatedMnemonic = await DubpRust.genMnemonic(language: Language.french); generatedMnemonic = await DubpRust.genMnemonic(language: Language.french);
this.actualWallet = await generateWallet(this.generatedMnemonic); actualWallet = await generateWallet(generatedMnemonic);
walletIsGenerated = true; walletIsGenerated = true;
} catch (e) { } catch (e) {
log.e(e); log.e(e);
@ -141,7 +141,7 @@ class GenerateWalletsProvider with ChangeNotifier {
Future<NewWallet> generateWallet(generatedMnemonic) async { Future<NewWallet> generateWallet(generatedMnemonic) async {
try { try {
this.actualWallet = await DubpRust.genWalletFromMnemonic( actualWallet = await DubpRust.genWalletFromMnemonic(
language: Language.french, language: Language.french,
mnemonic: generatedMnemonic, mnemonic: generatedMnemonic,
secretCodeType: SecretCodeType.letters, secretCodeType: SecretCodeType.letters,
@ -151,10 +151,10 @@ class GenerateWalletsProvider with ChangeNotifier {
} }
mnemonicController.text = generatedMnemonic; mnemonicController.text = generatedMnemonic;
pin.text = this.actualWallet.pin; pin.text = actualWallet.pin;
// notifyListeners(); // notifyListeners();
return this.actualWallet; return actualWallet;
} }
Future<NewWallet> changePinCode({bool reload}) async { Future<NewWallet> changePinCode({bool reload}) async {
@ -177,7 +177,7 @@ class GenerateWalletsProvider with ChangeNotifier {
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData()); final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
final pdf = pw.Document(); final pdf = pw.Document();
const imageProvider = const AssetImage('assets/icon/gecko_final.png'); const imageProvider = AssetImage('assets/icon/gecko_final.png');
final geckoLogo = await flutterImageProvider(imageProvider); final geckoLogo = await flutterImageProvider(imageProvider);
pdf.addPage( pdf.addPage(

View File

@ -3,8 +3,8 @@ 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/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/screens/history.dart'; import 'package:gecko/screens/history.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:jdenticon_dart/jdenticon_dart.dart'; import 'package:jdenticon_dart/jdenticon_dart.dart';
@ -42,7 +42,7 @@ class HistoryProvider with ChangeNotifier {
return 'false'; return 'false';
} }
if (barcode != null) { if (barcode != null) {
this.outputPubkey.text = barcode; outputPubkey.text = barcode;
isPubkey(context, barcode); isPubkey(context, barcode);
} else { } else {
return 'false'; return 'false';
@ -77,7 +77,7 @@ class HistoryProvider with ChangeNotifier {
String isPubkey(context, pubkey, {bool goHistory}) { String isPubkey(context, pubkey, {bool goHistory}) {
HomeProvider _homeProvider = HomeProvider _homeProvider =
Provider.of<HomeProvider>(context, listen: false); Provider.of<HomeProvider>(context, listen: false);
final RegExp regExp = new RegExp( final RegExp regExp = RegExp(
r'^[a-zA-Z0-9]+$', r'^[a-zA-Z0-9]+$',
caseSensitive: false, caseSensitive: false,
multiLine: false, multiLine: false,
@ -91,9 +91,9 @@ class HistoryProvider with ChangeNotifier {
this.pubkey = pubkey; this.pubkey = pubkey;
getShortPubkey(pubkey); getShortPubkey(pubkey);
this.outputPubkey.text = pubkey; outputPubkey.text = pubkey;
if (goHistory == null) goHistory = false; goHistory ??= false;
if (goHistory) { if (goHistory) {
isHistoryScreen = true; isHistoryScreen = true;
@ -144,13 +144,13 @@ class HistoryProvider with ChangeNotifier {
var transBC = []; var transBC = [];
int i = 0; int i = 0;
final currentBase = 0; const currentBase = 0;
double currentUD = 10.54; double currentUD = 10.54;
for (final trans in txs) { for (final trans in txs) {
var direction = trans['direction']; var direction = trans['direction'];
final transaction = trans['node']; final transaction = trans['node'];
var output; String output;
if (direction == "RECEIVED") { if (direction == "RECEIVED") {
for (String line in transaction['outputs']) { for (String line in transaction['outputs']) {
if (line.contains(_pubkey)) { if (line.contains(_pubkey)) {
@ -241,15 +241,15 @@ class HistoryProvider with ChangeNotifier {
} else { } else {
_message = "Vous êtes connecté au noeud\n${endPointGVA.split('/')[2]}"; _message = "Vous êtes connecté au noeud\n${endPointGVA.split('/')[2]}";
} }
final snackBar = final snackBar = SnackBar(
SnackBar(content: Text(_message), duration: Duration(seconds: 2)); content: Text(_message), duration: const Duration(seconds: 2));
isFirstBuild = false; isFirstBuild = false;
ScaffoldMessenger.of(context).showSnackBar(snackBar); ScaffoldMessenger.of(context).showSnackBar(snackBar);
} }
} }
void resetdHistory() { void resetdHistory() {
this.outputPubkey.text = ''; outputPubkey.text = '';
notifyListeners(); notifyListeners();
} }
@ -259,7 +259,7 @@ class HistoryProvider with ChangeNotifier {
} }
snackCopyKey(context) { snackCopyKey(context) {
final snackBar = SnackBar( const snackBar = SnackBar(
content: content:
Text("Cette clé publique a été copié dans votre presse-papier."), Text("Cette clé publique a été copié dans votre presse-papier."),
duration: Duration(seconds: 2)); duration: Duration(seconds: 2));

View File

@ -9,14 +9,14 @@ import 'package:flutter/services.dart';
import 'dart:async'; import 'dart:async';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/history.dart'; import 'package:gecko/screens/history.dart';
import 'package:gecko/screens/myWallets/walletsHome.dart'; import 'package:gecko/screens/myWallets/wallets_home.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
class HomeProvider with ChangeNotifier { class HomeProvider with ChangeNotifier {
int _currentIndex = 0; int _currentIndex = 0;
bool isSearching; bool isSearching;
Icon searchIcon = Icon(Icons.search); Icon searchIcon = const Icon(Icons.search);
final TextEditingController searchQuery = new TextEditingController(); final TextEditingController searchQuery = TextEditingController();
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850])); Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
Widget appBarExplorer = Widget appBarExplorer =
Text('Explorateur', style: TextStyle(color: Colors.grey[850])); Text('Explorateur', style: TextStyle(color: Colors.grey[850]));
@ -57,7 +57,7 @@ class HomeProvider with ChangeNotifier {
String _endpoint; String _endpoint;
int _statusCode = 0; int _statusCode = 0;
final _client = new HttpClient(); final _client = HttpClient();
_client.connectionTimeout = const Duration(milliseconds: 1000); _client.connectionTimeout = const Duration(milliseconds: 1000);
do { do {

View File

@ -2,7 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:async'; import 'dart:async';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
class MyWalletsProvider with ChangeNotifier { class MyWalletsProvider with ChangeNotifier {
List<WalletData> listWallets = []; List<WalletData> listWallets = [];
@ -41,12 +41,12 @@ class MyWalletsProvider with ChangeNotifier {
if (_id.isEmpty) return WalletData(); if (_id.isEmpty) return WalletData();
int _chest = _id[0]; int _chest = _id[0];
int _nbr = _id[1]; int _nbr = _id[1];
var _targetedWallet; WalletData _targetedWallet;
walletBox.toMap().forEach((key, value) { walletBox.toMap().forEach((key, value) {
if (value.chest == _chest && value.number == _nbr) { if (value.chest == _chest && value.number == _nbr) {
_targetedWallet = value; _targetedWallet = value;
return false; return;
} }
}); });
@ -86,19 +86,19 @@ class MyWalletsProvider with ChangeNotifier {
barrierDismissible: true, // user must tap button! barrierDismissible: true, // user must tap button!
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: title: const Text(
Text('Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'), 'Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'),
content: SingleChildScrollView(child: Text('')), content: const SingleChildScrollView(child: Text('')),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("Non"), child: const Text("Non"),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
TextButton( TextButton(
key: Key('confirmDeletingAllWallets'), key: const Key('confirmDeletingAllWallets'),
child: Text("Oui"), child: const Text("Oui"),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },

View File

@ -1,6 +1,6 @@
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
part 'walletData.g.dart'; part 'wallet_data.g.dart';
@HiveType(typeId: 0) @HiveType(typeId: 0)
class WalletData extends HiveObject { class WalletData extends HiveObject {
@ -25,16 +25,16 @@ class WalletData extends HiveObject {
// representation of WalletData when debugging // representation of WalletData when debugging
@override @override
String toString() { String toString() {
return this.name; return name;
} }
// creates the ':'-separated string from the WalletData // creates the ':'-separated string from the WalletData
String inLine() { String inLine() {
return "${this.chest}:${this.number}:${this.name}:${this.derivation}:${this.imageName}"; return "$chest:$number:$name:$derivation:$imageName";
} }
// returns only the id part of the ':'-separated string // returns only the id part of the ':'-separated string
List id() { List id() {
return [this.chest, this.number]; return [chest, number];
} }
} }

View File

@ -1,6 +1,6 @@
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'walletData.dart'; part of 'wallet_data.dart';
// ************************************************************************** // **************************************************************************
// TypeAdapterGenerator // TypeAdapterGenerator

View File

@ -8,18 +8,18 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:async'; import 'dart:async';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:truncate/truncate.dart'; import 'package:truncate/truncate.dart';
import 'package:qrscan/qrscan.dart' as scanner; import 'package:qrscan/qrscan.dart' as scanner;
class WalletOptionsProvider with ChangeNotifier { class WalletOptionsProvider with ChangeNotifier {
TextEditingController pubkey = TextEditingController(); TextEditingController pubkey = TextEditingController();
TextEditingController _newWalletName = TextEditingController(); final TextEditingController _newWalletName = TextEditingController();
bool isWalletUnlock = false; bool isWalletUnlock = false;
bool ischangedPin = false; bool ischangedPin = false;
TextEditingController newPin = new TextEditingController(); TextEditingController newPin = TextEditingController();
bool isEditing = false; bool isEditing = false;
bool isBalanceBlur = true; bool isBalanceBlur = true;
FocusNode walletNameFocus = FocusNode(); FocusNode walletNameFocus = FocusNode();
@ -32,7 +32,7 @@ class WalletOptionsProvider with ChangeNotifier {
Future _getPubkeyFromDewif( Future _getPubkeyFromDewif(
String _dewif, _pin, int _pinLenght, int derivation) async { String _dewif, _pin, int _pinLenght, int derivation) async {
String _pubkey; String _pubkey;
RegExp regExp = new RegExp( RegExp regExp = RegExp(
r'^[A-Z0-9]+$', r'^[A-Z0-9]+$',
caseSensitive: false, caseSensitive: false,
multiLine: false, multiLine: false,
@ -47,7 +47,7 @@ class WalletOptionsProvider with ChangeNotifier {
List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys( List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys(
dewif: _dewif, secretCode: _pin, accountsIndex: [derivation]); dewif: _dewif, secretCode: _pin, accountsIndex: [derivation]);
_pubkey = _pubkeysTmp[0]; _pubkey = _pubkeysTmp[0];
this.pubkey.text = _pubkey; pubkey.text = _pubkey;
notifyListeners(); notifyListeners();
return _pubkey; return _pubkey;
@ -60,7 +60,7 @@ class WalletOptionsProvider with ChangeNotifier {
} else { } else {
try { try {
_pubkey = await DubpRust.getDewifPublicKey(dewif: _dewif, pin: _pin); _pubkey = await DubpRust.getDewifPublicKey(dewif: _dewif, pin: _pin);
this.pubkey.text = _pubkey; pubkey.text = _pubkey;
notifyListeners(); notifyListeners();
return _pubkey; return _pubkey;
} catch (e) { } catch (e) {
@ -82,7 +82,7 @@ class WalletOptionsProvider with ChangeNotifier {
if ((_localPubkey = await _getPubkeyFromDewif( if ((_localPubkey = await _getPubkeyFromDewif(
_localDewif, _pin, _pinLenght, _wallet.derivation)) != _localDewif, _pin, _pinLenght, _wallet.derivation)) !=
'false') { 'false') {
this.pubkey.text = _localPubkey; pubkey.text = _localPubkey;
isWalletUnlock = true; isWalletUnlock = true;
return _localDewif; return _localDewif;
} else { } else {
@ -91,7 +91,7 @@ class WalletOptionsProvider with ChangeNotifier {
} catch (e) { } catch (e) {
// _homeProvider.playSound('non', 0.6); // _homeProvider.playSound('non', 0.6);
log.e('ERROR READING FILE: $e'); log.e('ERROR READING FILE: $e');
this.pubkey.clear(); pubkey.clear();
return 'bad'; return 'bad';
} }
} }
@ -142,16 +142,16 @@ class WalletOptionsProvider with ChangeNotifier {
barrierDismissible: true, barrierDismissible: true,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text('Choisissez un nouveau nom pour ce portefeuille'), title: const Text('Choisissez un nouveau nom pour ce portefeuille'),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
children: <Widget>[ children: <Widget>[
TextField( TextField(
controller: this._newWalletName, controller: _newWalletName,
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration(), decoration: const InputDecoration(),
style: TextStyle( style: const TextStyle(
fontSize: 14.0, fontSize: 14.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
@ -160,7 +160,7 @@ class WalletOptionsProvider with ChangeNotifier {
), ),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("Valider"), child: const Text("Valider"),
onPressed: () { onPressed: () {
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
// await _renameWallet(_walletName, this._newWalletName.text, // await _renameWallet(_walletName, this._newWalletName.text,
@ -219,20 +219,20 @@ class WalletOptionsProvider with ChangeNotifier {
'Êtes-vous sûr de vouloir supprimer le portefeuille "$_walletName" ?'), 'Êtes-vous sûr de vouloir supprimer le portefeuille "$_walletName" ?'),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
children: <Widget>[ children: const <Widget>[
Text('Vous pourrez restaurer ce portefeuille plus tard.'), Text('Vous pourrez restaurer ce portefeuille plus tard.'),
], ],
), ),
), ),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("Non", key: Key('cancelDeleting')), child: const Text("Non", key: Key('cancelDeleting')),
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
TextButton( TextButton(
child: Text("Oui", key: Key('confirmDeleting')), child: const Text("Oui", key: Key('confirmDeleting')),
onPressed: () { onPressed: () {
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
@ -244,7 +244,7 @@ class WalletOptionsProvider with ChangeNotifier {
} }
snackCopyKey(context) { snackCopyKey(context) {
final snackBar = SnackBar( const snackBar = SnackBar(
content: content:
Text("Cette clé publique a été copié dans votre presse-papier."), Text("Cette clé publique a été copié dans votre presse-papier."),
duration: Duration(seconds: 2)); duration: Duration(seconds: 2));

View File

@ -5,22 +5,22 @@ import 'package:gecko/globals.dart';
class CommonElements { class CommonElements {
// Exemple de Widget // Exemple de Widget
Widget exemple(String data) { Widget exemple(String data) {
return Text('Coucou'); return const Text('Coucou');
} }
Widget bubbleSpeak(String text, {double long, Key textKey}) { Widget bubbleSpeak(String text, {double long, Key textKey}) {
return Bubble( return Bubble(
padding: long == null padding: long == null
? BubbleEdges.all(18) ? const BubbleEdges.all(18)
: BubbleEdges.symmetric(horizontal: long, vertical: 30), : BubbleEdges.symmetric(horizontal: long, vertical: 30),
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
margin: BubbleEdges.fromLTRB(10, 0, 20, 10), margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop, // nip: BubbleNip.leftTop,
child: Text( child: Text(
text, text,
key: textKey, key: textKey,
style: TextStyle( style: const TextStyle(
color: Colors.black, fontSize: 18, fontWeight: FontWeight.w400), color: Colors.black, fontSize: 18, fontWeight: FontWeight.w400),
), ),
); );
@ -28,15 +28,15 @@ class CommonElements {
Widget bubbleSpeakRich(List<TextSpan> text, {Key textKey}) { Widget bubbleSpeakRich(List<TextSpan> text, {Key textKey}) {
return Bubble( return Bubble(
padding: BubbleEdges.all(18), padding: const BubbleEdges.all(18),
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
margin: BubbleEdges.fromLTRB(10, 0, 20, 10), margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop, // nip: BubbleNip.leftTop,
child: RichText( child: RichText(
key: textKey, key: textKey,
text: TextSpan( text: TextSpan(
style: TextStyle( style: const TextStyle(
fontSize: 18.0, fontSize: 18.0,
color: Colors.black, color: Colors.black,
), ),
@ -87,7 +87,7 @@ class CommonElements {
top: 70, top: 70,
right: 90, right: 90,
child: Text(progress == 12 ? '11/11' : '$progress/11', child: Text(progress == 12 ? '11/11' : '$progress/11',
style: TextStyle(fontSize: 12, color: Colors.black)), style: const TextStyle(fontSize: 12, color: Colors.black)),
), ),
]); ]);
} }
@ -102,7 +102,7 @@ class CommonElements {
return Container( return Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(0xffFFD58D), // button color
child: InkWell( child: InkWell(
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: Padding(
@ -113,7 +113,7 @@ class CommonElements {
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -207,14 +207,14 @@ class GeckoSpeechAppBar extends StatelessWidget with PreferredSizeWidget {
GeckoSpeechAppBar( GeckoSpeechAppBar(
this.title, { this.title, {
Key key, Key key,
}) : preferredSize = Size.fromHeight(105.4), }) : preferredSize = const Size.fromHeight(105.4),
super(key: key); super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( return AppBar(
leading: IconButton( leading: IconButton(
icon: Container( icon: SizedBox(
height: 30, height: 30,
child: Image.asset('assets/onBoarding/gecko_bar.png')), child: Image.asset('assets/onBoarding/gecko_bar.png')),
onPressed: () => Navigator.popUntil( onPressed: () => Navigator.popUntil(

View File

@ -1,15 +1,15 @@
import 'dart:io'; 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/cesium_plus.dart';
import 'package:gecko/models/home.dart'; import 'package:gecko/models/home.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.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';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/screens/myWallets/unlockingWallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'dart:ui'; import 'dart:ui';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -22,7 +22,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
final nRepositories = 20; final nRepositories = 20;
// HistoryProvider _historyProvider; // HistoryProvider _historyProvider;
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
FocusNode _pubkeyFocus = FocusNode(); final FocusNode _pubkeyFocus = FocusNode();
List cesiumData; List cesiumData;
final double avatarsSize = 80; final double avatarsSize = 80;
@ -30,12 +30,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
FetchMoreOptions opts; FetchMoreOptions opts;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
HistoryScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context); HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
HomeProvider _homeProvider = Provider.of<HomeProvider>(context); HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
this._outputPubkey.text = _historyProvider.pubkey; _outputPubkey.text = _historyProvider.pubkey;
log.i('Build pubkey : ' + _historyProvider.pubkey); log.i('Build pubkey : ' + _historyProvider.pubkey);
WidgetsBinding.instance.addPostFrameCallback((_) {}); WidgetsBinding.instance.addPostFrameCallback((_) {});
@ -45,7 +47,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
title: _homeProvider.appBarExplorer, title: _homeProvider.appBarExplorer,
actions: [ actions: [
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: IconButton( child: IconButton(
icon: _homeProvider.searchIcon, icon: _homeProvider.searchIcon,
color: Colors.grey[850], color: Colors.grey[850],
@ -81,9 +83,9 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
} }
})) }))
], ],
backgroundColor: Color(0xffFFD58D), backgroundColor: const Color(0xffFFD58D),
), ),
floatingActionButton: Container( floatingActionButton: SizedBox(
height: 80.0, height: 80.0,
width: 80.0, width: 80.0,
child: FittedBox( child: FittedBox(
@ -92,11 +94,11 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
onPressed: () async { onPressed: () async {
await _historyProvider.scan(context); await _historyProvider.scan(context);
}, },
child: Container( child: SizedBox(
height: 40.0, height: 40.0,
width: 40.0, width: 40.0,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 3), padding: const EdgeInsets.symmetric(horizontal: 3),
child: Image.asset('assets/qrcode-scan.png'))), child: Image.asset('assets/qrcode-scan.png'))),
backgroundColor: backgroundColor:
floattingYellow, //smoothYellow, //Color.fromARGB(500, 204, 255, 255), floattingYellow, //smoothYellow, //Color.fromARGB(500, 204, 255, 255),
@ -104,7 +106,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
), ),
), ),
body: Column(children: <Widget>[ body: Column(children: <Widget>[
SizedBox(height: 0), const SizedBox(height: 0),
if (_historyProvider.pubkey != '') if (_historyProvider.pubkey != '')
historyQuery(context, _historyProvider), historyQuery(context, _historyProvider),
])); ]));
@ -139,7 +141,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
if (result.hasException) { if (result.hasException) {
log.e('Error GVA: ' + result.exception.toString()); log.e('Error GVA: ' + result.exception.toString());
return Column(children: <Widget>[ return Column(children: const <Widget>[
SizedBox(height: 50), SizedBox(height: 50),
Text( Text(
"Aucun noeud GVA valide n'a pu être trouvé.\nVeuillez réessayer ultérieurement.", "Aucun noeud GVA valide n'a pu être trouvé.\nVeuillez réessayer ultérieurement.",
@ -171,10 +173,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
child: Builder( child: Builder(
builder: (context) => Expanded( builder: (context) => Expanded(
child: ListView( child: ListView(
key: Key('listTransactions'), key: const Key('listTransactions'),
controller: scrollController, controller: scrollController,
children: <Widget>[ children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
if (_historyProvider.pubkey != '') if (_historyProvider.pubkey != '')
Row( Row(
mainAxisAlignment: mainAxisAlignment:
@ -214,7 +216,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
if (_avatar.hasData) { if (_avatar.hasData) {
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.all(0.0), const EdgeInsets.all(
0.0),
child: Image.file( child: Image.file(
_avatar.data[0], _avatar.data[0],
height: avatarsSize)); height: avatarsSize));
@ -225,7 +228,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
height: avatarsSize); height: avatarsSize);
})), })),
GestureDetector( GestureDetector(
key: Key('copyPubkey'), key: const Key('copyPubkey'),
onTap: () { onTap: () {
Clipboard.setData(ClipboardData( Clipboard.setData(ClipboardData(
text: _historyProvider.pubkey)); text: _historyProvider.pubkey));
@ -234,7 +237,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
child: Text( child: Text(
_historyProvider.getShortPubkey( _historyProvider.getShortPubkey(
_historyProvider.pubkey), _historyProvider.pubkey),
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace')), fontFamily: 'Monospace')),
@ -257,7 +260,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
], ],
), ),
)), )),
SizedBox(width: 0) const SizedBox(width: 0)
]), ]),
if (_isFirstExec) if (_isFirstExec)
Row( Row(
@ -274,25 +277,22 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
_historyProvider.pubkey), _historyProvider.pubkey),
initialData: '...', initialData: '...',
builder: (context, snapshot) { builder: (context, snapshot) {
return Text( return Text(snapshot.data ?? '-',
snapshot.data != null style: const TextStyle(
? snapshot.data fontSize: 20));
: '-',
style:
TextStyle(fontSize: 20));
})) }))
]), ]),
SizedBox(height: 18), const SizedBox(height: 18),
if (_isFirstExec) if (_isFirstExec)
Container( Container(
padding: padding:
const EdgeInsets.fromLTRB(0, 0, 0, 0), const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Text(balance.toString() + ' Ğ1', child: Text(balance.toString() + ' Ğ1',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 18.0))), style: const TextStyle(fontSize: 18.0))),
SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
key: Key('switchPayHistory'), key: const Key('switchPayHistory'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 1, elevation: 1,
primary: Colors.grey[50], // background primary: Colors.grey[50], // background
@ -344,32 +344,32 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
Text('Commentaire:', style: TextStyle(fontSize: 20.0)), const Text('Commentaire:', style: TextStyle(fontSize: 20.0)),
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextField( child: TextField(
controller: _historyProvider.payComment, controller: _historyProvider.payComment,
maxLines: 2, maxLines: 2,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration(), decoration: const InputDecoration(),
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold))), fontWeight: FontWeight.bold))),
SizedBox(height: 20), const SizedBox(height: 20),
Text('Montant (DU/Ğ1):', style: TextStyle(fontSize: 20.0)), const Text('Montant (DU/Ğ1):', style: TextStyle(fontSize: 20.0)),
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 22), style: const TextStyle(fontSize: 22),
controller: _historyProvider.payAmount, controller: _historyProvider.payAmount,
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 1, maxLines: 1,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: contentPadding: const EdgeInsets.symmetric(
EdgeInsets.symmetric(vertical: 25.0, horizontal: 10.0), vertical: 25.0, horizontal: 10.0),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0)), borderRadius: BorderRadius.circular(10.0)),
), ),
@ -412,7 +412,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
int keyID = 0; int keyID = 0;
return _historyProvider.transBC == null return _historyProvider.transBC == null
? Text('Aucune transaction à afficher.') ? const Text('Aucune transaction à afficher.')
: Column(children: <Widget>[ : Column(children: <Widget>[
for (var repository in _historyProvider.transBC) for (var repository in _historyProvider.transBC)
Padding( Padding(
@ -427,14 +427,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
textAlign: TextAlign.center), textAlign: TextAlign.center),
title: Text(repository[3], title: Text(repository[3],
style: TextStyle( style: const TextStyle(
fontSize: 15.0, fontFamily: 'Monospace'), fontSize: 15.0, fontFamily: 'Monospace'),
textAlign: TextAlign.center), textAlign: TextAlign.center),
subtitle: Text(repository[6] != '' ? repository[6] : '-', subtitle: Text(repository[6] != '' ? repository[6] : '-',
style: TextStyle(fontSize: 12.0), style: const TextStyle(fontSize: 12.0),
textAlign: TextAlign.center), textAlign: TextAlign.center),
trailing: Text("${repository[4]} Ğ1", trailing: Text("${repository[4]} Ğ1",
style: TextStyle(fontSize: 14.0), style: const TextStyle(fontSize: 14.0),
textAlign: TextAlign.justify), textAlign: TextAlign.justify),
dense: true, dense: true,
isThreeLine: false, isThreeLine: false,
@ -445,14 +445,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
if (result.isLoading) if (result.isLoading)
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: const <Widget>[
CircularProgressIndicator(), CircularProgressIndicator(),
], ],
), ),
// if (_historyProvider.isTheEnd) // What I did before ... // if (_historyProvider.isTheEnd) // What I did before ...
if (!_historyProvider.pageInfo['hasPreviousPage']) if (!_historyProvider.pageInfo['hasPreviousPage'])
Column( Column(
children: <Widget>[ children: const <Widget>[
SizedBox(height: 15), SizedBox(height: 15),
Text("Début de l'historique.", Text("Début de l'historique.",
textAlign: TextAlign.center, textAlign: TextAlign.center,

View File

@ -3,16 +3,18 @@ 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/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/screens/myWallets/unlockingWallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart'; import 'package:gecko/screens/onBoarding/0_no_keychain_found.dart';
import 'dart:ui'; import 'dart:ui';
import 'package:gecko/screens/settings.dart'; import 'package:gecko/screens/settings.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class HomeScreen extends StatelessWidget { class HomeScreen extends StatelessWidget {
const HomeScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -46,7 +48,7 @@ class HomeScreen extends StatelessWidget {
Expanded( Expanded(
child: ListView(padding: EdgeInsets.zero, children: <Widget>[ child: ListView(padding: EdgeInsets.zero, children: <Widget>[
DrawerHeader( DrawerHeader(
child: Column(children: <Widget>[ child: Column(children: const <Widget>[
SizedBox(height: 0), SizedBox(height: 0),
Image( Image(
image: AssetImage('assets/icon/gecko_final.png'), image: AssetImage('assets/icon/gecko_final.png'),
@ -57,8 +59,8 @@ class HomeScreen extends StatelessWidget {
), ),
), ),
ListTile( ListTile(
key: Key('parameters'), key: const Key('parameters'),
title: Text('Paramètres'), title: const Text('Paramètres'),
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
Navigator.push( Navigator.push(
@ -70,34 +72,33 @@ class HomeScreen extends StatelessWidget {
}, },
), ),
ListTile( ListTile(
title: Text('A propos'), title: const Text('A propos'),
onTap: () { onTap: () {
// Update the state of the app. // Update the state of the app.
// ... // ...
}, },
), ),
])), ])),
Container( Align(
child: Align( alignment: FractionalOffset.bottomCenter,
alignment: FractionalOffset.bottomCenter, child: Text('Ğecko v$appVersion')),
child: Text('Ğecko v$appVersion'))), const SizedBox(height: 20)
SizedBox(height: 20)
], ],
), ),
), ),
appBar: AppBar( appBar: AppBar(
leading: Builder( leading: Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
key: Key('drawerMenu'), key: const Key('drawerMenu'),
icon: new Icon(Icons.menu, color: Colors.grey[850]), icon: 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: const EdgeInsets.symmetric(horizontal: 16),
child: IconButton( child: IconButton(
key: Key('searchIcon'), key: const Key('searchIcon'),
icon: _homeProvider.searchIcon, icon: _homeProvider.searchIcon,
color: Colors.grey[850], color: Colors.grey[850],
onPressed: () { onPressed: () {
@ -107,7 +108,7 @@ class HomeScreen extends StatelessWidget {
color: Colors.grey[850], color: Colors.grey[850],
); );
_homeProvider.appBarTitle = TextField( _homeProvider.appBarTitle = TextField(
key: Key('searchInput'), key: const Key('searchInput'),
autofocus: true, autofocus: true,
controller: _homeProvider.searchQuery, controller: _homeProvider.searchQuery,
onChanged: (text) { onChanged: (text) {
@ -133,9 +134,9 @@ class HomeScreen extends StatelessWidget {
} }
})) }))
], ],
backgroundColor: Color(0xffFFD58D), backgroundColor: const Color(0xffFFD58D),
), ),
backgroundColor: Color(0xffF9F9F1), backgroundColor: const Color(0xffF9F9F1),
body: Builder( body: Builder(
builder: (ctx) => StatefulWrapper( builder: (ctx) => StatefulWrapper(
onInit: () { onInit: () {
@ -146,10 +147,10 @@ class HomeScreen extends StatelessWidget {
}, },
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(top: 20), padding: const EdgeInsets.only(top: 20),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: const <Widget>[
SizedBox(width: 7), SizedBox(width: 7),
Image( Image(
image: image:
@ -157,10 +158,10 @@ class HomeScreen extends StatelessWidget {
height: 180), height: 180),
])), ])),
Padding( Padding(
padding: EdgeInsets.only(top: 15), padding: const EdgeInsets.only(top: 15),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: const <Widget>[
Text( Text(
"y'a pas de lézard !", "y'a pas de lézard !",
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -171,7 +172,7 @@ class HomeScreen extends StatelessWidget {
) )
])), ])),
Padding( Padding(
padding: EdgeInsets.only(top: 60), padding: const EdgeInsets.only(top: 60),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
@ -179,10 +180,11 @@ class HomeScreen extends StatelessWidget {
Container( Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(
0xffFFD58D), // button color
child: InkWell( child: InkWell(
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: const Padding(
padding: EdgeInsets.all(22), padding: EdgeInsets.all(22),
child: Image( child: Image(
image: AssetImage( image: AssetImage(
@ -194,7 +196,7 @@ class HomeScreen extends StatelessWidget {
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -206,8 +208,8 @@ class HomeScreen extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 12), const SizedBox(height: 12),
Text( const Text(
"Payer par QR-Code", "Payer par QR-Code",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -216,7 +218,7 @@ class HomeScreen extends StatelessWidget {
]) ])
])), ])),
Padding( Padding(
padding: EdgeInsets.only(top: 50), padding: const EdgeInsets.only(top: 50),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
@ -224,10 +226,11 @@ class HomeScreen extends StatelessWidget {
Container( Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(
0xffFFD58D), // button color
child: InkWell( child: InkWell(
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: const Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 20, vertical: 16), horizontal: 20, vertical: 16),
child: Image( child: Image(
@ -245,7 +248,7 @@ class HomeScreen extends StatelessWidget {
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -257,24 +260,25 @@ class HomeScreen extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 12), const SizedBox(height: 12),
Text( const Text(
"Explorer\n", "Explorer\n",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.black, fontSize: 16), color: Colors.black, fontSize: 16),
) )
]), ]),
SizedBox(width: 140), const SizedBox(width: 140),
Column(children: <Widget>[ Column(children: <Widget>[
Container( Container(
child: ClipOval( child: ClipOval(
key: Key('manageWallets'), key: const Key('manageWallets'),
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(
0xffFFD58D), // button color
child: InkWell( child: InkWell(
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: const Padding(
padding: EdgeInsets.all(23), padding: EdgeInsets.all(23),
child: Image( child: Image(
image: AssetImage( image: AssetImage(
@ -296,12 +300,12 @@ class HomeScreen extends StatelessWidget {
: Navigator.push(context, : Navigator.push(context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) { builder: (context) {
return NoKeyChainScreen(); return const NoKeyChainScreen();
})); }));
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -313,8 +317,8 @@ class HomeScreen extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 12), const SizedBox(height: 12),
Text( const Text(
"Gérer mes\nportefeuilles", "Gérer mes\nportefeuilles",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -351,7 +355,8 @@ class HomeScreen extends StatelessWidget {
class StatefulWrapper extends StatefulWidget { class StatefulWrapper extends StatefulWidget {
final Function onInit; final Function onInit;
final Widget child; final Widget child;
const StatefulWrapper({@required this.onInit, @required this.child}); const StatefulWrapper({Key key, @required this.onInit, @required this.child})
: super(key: key);
@override @override
_StatefulWrapperState createState() => _StatefulWrapperState(); _StatefulWrapperState createState() => _StatefulWrapperState();
} }

View File

@ -3,10 +3,10 @@ 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/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/queries.dart'; import 'package:gecko/models/queries.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -42,8 +42,9 @@ class CesiumWalletOptions extends StatelessWidget {
_walletOptions.nameController.text.length >= 15 _walletOptions.nameController.text.length >= 15
? _nbrLinesName = 2 ? _nbrLinesName = 2
: _nbrLinesName = 1; : _nbrLinesName = 1;
if (_walletOptions.nameController.text.length >= 26 && isTall) if (_walletOptions.nameController.text.length >= 26 && isTall) {
_nbrLinesName = 3; _nbrLinesName = 3;
}
_walletOptions.walletID = [0, cesiumWallet.number]; _walletOptions.walletID = [0, cesiumWallet.number];
@ -71,7 +72,7 @@ class CesiumWalletOptions extends StatelessWidget {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
_walletOptions.isEditing = false; _walletOptions.isEditing = false;
_walletOptions.isBalanceBlur = true; _walletOptions.isBalanceBlur = true;
@ -98,11 +99,11 @@ class CesiumWalletOptions extends StatelessWidget {
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
yellowC, yellowC,
Color(0xfffafafa), const Color(0xfffafafa),
], ],
)), )),
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 25), const SizedBox(width: 25),
InkWell( InkWell(
onTap: () async { onTap: () async {
await _walletOptions.changeAvatar(); await _walletOptions.changeAvatar();
@ -119,7 +120,7 @@ class CesiumWalletOptions extends StatelessWidget {
Image.asset( Image.asset(
'assets/walletOptions/camera.png', 'assets/walletOptions/camera.png',
), ),
SizedBox(height: 100) const SizedBox(height: 100)
])), ])),
Column(children: <Widget>[ Column(children: <Widget>[
Row(children: <Widget>[ Row(children: <Widget>[
@ -127,14 +128,14 @@ class CesiumWalletOptions extends StatelessWidget {
SizedBox( SizedBox(
width: 260, width: 260,
child: TextField( child: TextField(
key: Key('walletName'), key: const Key('walletName'),
autofocus: false, autofocus: false,
focusNode: _walletOptions.walletNameFocus, focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing, enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController, controller: _walletOptions.nameController,
maxLines: _nbrLinesName, maxLines: _nbrLinesName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: const InputDecoration(
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
@ -163,7 +164,7 @@ class CesiumWalletOptions extends StatelessWidget {
} }
if (result.isLoading) { if (result.isLoading) {
return Text('Loading'); return const Text('Loading');
} }
// List repositories = result.data['viewer']['repositories']['nodes']; // List repositories = result.data['viewer']['repositories']['nodes'];
@ -190,7 +191,7 @@ class CesiumWalletOptions extends StatelessWidget {
sigmaY: _walletOptions.isBalanceBlur sigmaY: _walletOptions.isBalanceBlur
? 5 ? 5
: 0), : 0),
child: Text('$wBalanceUD', child: Text(wBalanceUD,
style: TextStyle( style: TextStyle(
fontSize: isTall ? 20 : 18, fontSize: isTall ? 20 : 18,
color: Colors.black)), color: Colors.black)),
@ -208,9 +209,9 @@ class CesiumWalletOptions extends StatelessWidget {
// ); // );
}, },
), ),
SizedBox(height: 5), const SizedBox(height: 5),
InkWell( InkWell(
key: Key('displayBalance'), key: const Key('displayBalance'),
onTap: () { onTap: () {
_walletOptions.bluringBalance(); _walletOptions.bluringBalance();
}, },
@ -220,15 +221,15 @@ class CesiumWalletOptions extends StatelessWidget {
: 'assets/walletOptions/icon_oeuil_close.png', : 'assets/walletOptions/icon_oeuil_close.png',
)), )),
]), ]),
SizedBox(width: 0), const SizedBox(width: 0),
Column(children: <Widget>[ Column(children: <Widget>[
InkWell( InkWell(
key: Key('renameWallet'), key: const Key('renameWallet'),
onTap: () async { onTap: () async {
_isNewNameValid = _walletOptions _isNewNameValid = _walletOptions
.editWalletName(_walletOptions.walletID); .editWalletName(_walletOptions.walletID);
await Future.delayed( await Future.delayed(
Duration(milliseconds: 30)); const Duration(milliseconds: 30));
_walletOptions.walletNameFocus.requestFocus(); _walletOptions.walletNameFocus.requestFocus();
}, },
child: ClipRRect( child: ClipRRect(
@ -239,7 +240,7 @@ class CesiumWalletOptions extends StatelessWidget {
width: 20, width: 20,
height: 20), height: 20),
)), )),
SizedBox( const SizedBox(
height: 60, height: 60,
) )
]) ])
@ -254,11 +255,11 @@ class CesiumWalletOptions extends StatelessWidget {
return snapshot.data != null return snapshot.data != null
? Image.memory(snapshot.data, ? Image.memory(snapshot.data,
height: isTall ? 300 : 270) height: isTall ? 300 : 270)
: Text('-', style: TextStyle(fontSize: 20)); : const Text('-', style: TextStyle(fontSize: 20));
}), }),
SizedBox(height: 15 * ratio), SizedBox(height: 15 * ratio),
GestureDetector( GestureDetector(
key: Key('copyPubkey'), key: const Key('copyPubkey'),
onTap: () { onTap: () {
Clipboard.setData( Clipboard.setData(
ClipboardData(text: _walletOptions.pubkey.text)); ClipboardData(text: _walletOptions.pubkey.text));
@ -267,30 +268,29 @@ class CesiumWalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/key.png', 'assets/walletOptions/key.png',
), ),
SizedBox(width: 10), const SizedBox(width: 10),
Text("${shortPubkey.split(':')[0]}:", Text("${shortPubkey.split(':')[0]}:",
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace', fontFamily: 'Monospace',
color: Colors.black)), color: Colors.black)),
Text(shortPubkey.split(':')[1], Text(shortPubkey.split(':')[1],
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace')), fontFamily: 'Monospace')),
SizedBox(width: 15), const SizedBox(width: 15),
SizedBox( SizedBox(
height: 40, height: 40,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius: BorderRadius.circular(8),
new BorderRadius.circular(8),
), ),
elevation: 1, elevation: 1,
primary: orangeC, // background primary: orangeC, // background
@ -305,7 +305,7 @@ class CesiumWalletOptions extends StatelessWidget {
Image.asset( Image.asset(
'assets/walletOptions/copy-white.png', 'assets/walletOptions/copy-white.png',
), ),
SizedBox(width: 7), const SizedBox(width: 7),
Text('Copier', Text('Copier',
style: TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
@ -314,7 +314,7 @@ class CesiumWalletOptions extends StatelessWidget {
]))), ]))),
SizedBox(height: 10 * ratio), SizedBox(height: 10 * ratio),
InkWell( InkWell(
key: Key('displayHistory'), key: const Key('displayHistory'),
onTap: () { onTap: () {
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text, _historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
goHistory: true); goHistory: true);
@ -322,18 +322,18 @@ class CesiumWalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/clock.png', 'assets/walletOptions/clock.png',
), ),
SizedBox(width: 12), const SizedBox(width: 12),
Text('Historique des transactions', const Text('Historique des transactions',
style: style:
TextStyle(fontSize: 20, color: Colors.black)), TextStyle(fontSize: 20, color: Colors.black)),
]))), ]))),
SizedBox(height: 12 * ratio), SizedBox(height: 12 * ratio),
InkWell( InkWell(
key: Key('setDefaultWallet'), key: const Key('setDefaultWallet'),
onTap: !_walletOptions.isDefaultWallet onTap: !_walletOptions.isDefaultWallet
? () { ? () {
defaultWallet = cesiumWallet; defaultWallet = cesiumWallet;
@ -346,14 +346,14 @@ class CesiumWalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 31), const SizedBox(width: 31),
CircleAvatar( CircleAvatar(
backgroundColor: Colors.grey[ backgroundColor: Colors.grey[
_walletOptions.isDefaultWallet ? 300 : 500], _walletOptions.isDefaultWallet ? 300 : 500],
child: Image.asset( child: Image.asset(
'assets/walletOptions/android-checkmark.png', 'assets/walletOptions/android-checkmark.png',
)), )),
SizedBox(width: 12), const SizedBox(width: 12),
Text( Text(
_walletOptions.isDefaultWallet _walletOptions.isDefaultWallet
? 'Ce portefeuille est celui par defaut' ? 'Ce portefeuille est celui par defaut'
@ -367,7 +367,7 @@ class CesiumWalletOptions extends StatelessWidget {
SizedBox(height: 17 * ratio), SizedBox(height: 17 * ratio),
if (!_walletOptions.isDefaultWallet) if (!_walletOptions.isDefaultWallet)
InkWell( InkWell(
key: Key('deleteWallet'), key: const Key('deleteWallet'),
onTap: !_walletOptions.isDefaultWallet onTap: !_walletOptions.isDefaultWallet
? () async { ? () async {
await _walletOptions.deleteWallet( await _walletOptions.deleteWallet(
@ -381,12 +381,12 @@ class CesiumWalletOptions extends StatelessWidget {
} }
: null, : null,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 33), const SizedBox(width: 33),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
), ),
SizedBox(width: 14), const SizedBox(width: 14),
Text('Supprimer ce portefeuille', const Text('Supprimer ce portefeuille',
style: TextStyle( style: TextStyle(
fontSize: 20, color: Color(0xffD80000))), fontSize: 20, color: Color(0xffD80000))),
])), ])),

View File

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/changePin.dart'; import 'package:gecko/models/change_pin.dart';
import 'dart:io'; import 'dart:io';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -13,7 +13,7 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
{Key keyMyWallets, @required this.walletName, @required this.oldPin}) {Key keyMyWallets, @required this.walletName, @required this.oldPin})
: super(key: keyMyWallets); : super(key: keyMyWallets);
final String walletName; final String walletName;
final oldPin; final String oldPin;
Directory appPath; Directory appPath;
NewWallet _newWalletFile; NewWallet _newWalletFile;
@ -32,7 +32,7 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
_changePin.newPin.text = ''; _changePin.newPin.text = '';
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -44,7 +44,7 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
body: Center( body: Center(
child: SafeArea( child: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 80), const SizedBox(height: 80),
Text( Text(
'Choisissez un code secret autogénéré :', 'Choisissez un code secret autogénéré :',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -53,33 +53,31 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
color: Colors.grey[600], color: Colors.grey[600],
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
), ),
SizedBox(height: 30), const SizedBox(height: 30),
Container( Stack(
child: Stack( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, children: <Widget>[
children: <Widget>[ TextField(
TextField( enabled: true,
enabled: true, controller: _changePin.newPin,
controller: _changePin.newPin, maxLines: 1,
maxLines: 1, textAlign: TextAlign.center,
textAlign: TextAlign.center, decoration: const InputDecoration(),
decoration: InputDecoration(), style: const TextStyle(
style: TextStyle( fontSize: 30.0,
fontSize: 30.0, color: Colors.black,
color: Colors.black, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold)), IconButton(
IconButton( icon: const Icon(Icons.replay),
icon: Icon(Icons.replay), color: orangeC,
color: orangeC, onPressed: () async {
onPressed: () async { _newWalletFile =
_newWalletFile = await _changePin.changePin(walletName, oldPin);
await _changePin.changePin(walletName, oldPin); },
}, ),
), ],
],
),
), ),
SizedBox(height: 30), const SizedBox(height: 30),
SizedBox( SizedBox(
width: 200, width: 200,
height: 50, height: 50,
@ -96,7 +94,8 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
context, _newWalletFile); context, _newWalletFile);
} }
: null, : null,
child: Text('Confirmer', style: TextStyle(fontSize: 28))), child: const Text('Confirmer',
style: TextStyle(fontSize: 28))),
) )
]))))); ])))));
} }

View File

@ -1,7 +1,7 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/screens/onBoarding/1.dart'; import 'package:gecko/screens/onBoarding/1.dart';
import 'package:carousel_slider/carousel_slider.dart'; import 'package:carousel_slider/carousel_slider.dart';
@ -12,6 +12,8 @@ class ChooseChest extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
CarouselController buttonCarouselController = CarouselController(); CarouselController buttonCarouselController = CarouselController();
ChooseChest({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,13 +24,13 @@ class ChooseChest extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Sélectionner mon coffre'), child: Text('Sélectionner mon coffre'),
)), )),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 190), const SizedBox(height: 190),
CarouselSlider( CarouselSlider(
carouselController: buttonCarouselController, carouselController: buttonCarouselController,
options: CarouselOptions( options: CarouselOptions(
@ -48,10 +50,10 @@ class ChooseChest extends StatelessWidget {
Image.asset( Image.asset(
'assets/chests/${i.value.imageName}', 'assets/chests/${i.value.imageName}',
), ),
SizedBox(height: 30), const SizedBox(height: 30),
Text( Text(
i.value.name, i.value.name,
style: TextStyle(fontSize: 21), style: const TextStyle(fontSize: 21),
), ),
]); ]);
}, },
@ -59,13 +61,13 @@ class ChooseChest extends StatelessWidget {
}).toList(), }).toList(),
), ),
Image.asset('assets/chests/vector.png'), Image.asset('assets/chests/vector.png'),
SizedBox(height: 15), const SizedBox(height: 15),
Text( const Text(
'Choisir un autre\ncoffre', 'Choisir un autre\ncoffre',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 13), style: TextStyle(fontSize: 13),
), ),
SizedBox(height: 80), const SizedBox(height: 80),
SizedBox( SizedBox(
width: 400, width: 400,
height: 70, height: 70,
@ -91,9 +93,9 @@ class ChooseChest extends StatelessWidget {
), ),
), ),
), ),
SizedBox(height: 20), const SizedBox(height: 20),
InkWell( InkWell(
key: Key('createNewChest'), key: const Key('createNewChest'),
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@ -110,7 +112,7 @@ class ChooseChest extends StatelessWidget {
color: orangeC, color: orangeC,
fontWeight: FontWeight.w600))), fontWeight: FontWeight.w600))),
)), )),
SizedBox(height: 10), const SizedBox(height: 10),
]), ]),
)); ));
} }

View File

@ -3,9 +3,9 @@ import 'dart:async';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -19,10 +19,10 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
String generatedMnemonic; String generatedMnemonic;
NewWallet generatedWallet; NewWallet generatedWallet;
TextEditingController _mnemonicController = TextEditingController(); final TextEditingController _mnemonicController = TextEditingController();
TextEditingController _inputRestoreWord = TextEditingController(); final TextEditingController _inputRestoreWord = TextEditingController();
TextEditingController walletName = TextEditingController(); TextEditingController walletName = TextEditingController();
FocusNode _wordFocus = FocusNode(); final FocusNode _wordFocus = FocusNode();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,7 +35,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
Provider.of<WalletOptionsProvider>(context); Provider.of<WalletOptionsProvider>(context);
final int _currentChest = _myWalletProvider.getCurrentChest(); final int _currentChest = _myWalletProvider.getCurrentChest();
this._mnemonicController.text = generatedMnemonic; _mnemonicController.text = generatedMnemonic;
return WillPopScope( return WillPopScope(
onWillPop: () { onWillPop: () {
_generateWalletProvider.isAskedWordValid = false; _generateWalletProvider.isAskedWordValid = false;
@ -46,20 +46,20 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
_generateWalletProvider.isAskedWordValid = false; _generateWalletProvider.isAskedWordValid = false;
_generateWalletProvider.askedWordColor = Colors.black; _generateWalletProvider.askedWordColor = Colors.black;
}), }),
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Enregistrer ce trousseau'), child: Text('Enregistrer ce trousseau'),
)), )),
body: Center( body: Center(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 15), const SizedBox(height: 15),
Container( SizedBox(
width: 360, width: 360,
child: Text( child: Text(
'Quel est le ${_generateWalletProvider.nbrWord + 1}ème mot de votre phrase de restauration ?', 'Quel est le ${_generateWalletProvider.nbrWord + 1}ème mot de votre phrase de restauration ?',
@ -70,11 +70,11 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
)), )),
TextFormField( TextFormField(
key: Key('askedWord'), key: const Key('askedWord'),
focusNode: _wordFocus, focusNode: _wordFocus,
autofocus: true, autofocus: true,
enabled: !_generateWalletProvider.isAskedWordValid, enabled: !_generateWalletProvider.isAskedWordValid,
controller: this._inputRestoreWord, controller: _inputRestoreWord,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
onChanged: (value) { onChanged: (value) {
_generateWalletProvider.checkAskedWord( _generateWalletProvider.checkAskedWord(
@ -82,13 +82,13 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
}, },
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration(), decoration: const InputDecoration(),
style: TextStyle( style: TextStyle(
fontSize: 30.0, fontSize: 30.0,
color: _generateWalletProvider.askedWordColor, color: _generateWalletProvider.askedWordColor,
fontWeight: FontWeight.w500)), fontWeight: FontWeight.w500)),
SizedBox(height: 12), const SizedBox(height: 12),
Container( SizedBox(
width: 360, width: 360,
child: Text( child: Text(
'Choisissez un nom pour votre premier portefeuille :', 'Choisissez un nom pour votre premier portefeuille :',
@ -99,21 +99,21 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
)), )),
TextFormField( TextFormField(
key: Key('walletName'), key: const Key('walletName'),
focusNode: _generateWalletProvider.walletNameFocus, focusNode: _generateWalletProvider.walletNameFocus,
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow( FilteringTextInputFormatter.allow(
RegExp('[A-Za-z|0-9|\\-|_| ]')), RegExp('[A-Za-z|0-9|\\-|_| ]')),
], ],
controller: this.walletName, controller: walletName,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
onChanged: (v) { onChanged: (v) {
_generateWalletProvider.nameChanged(); _generateWalletProvider.nameChanged();
}, },
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration(), decoration: const InputDecoration(),
style: TextStyle( style: const TextStyle(
fontSize: 30.0, fontSize: 30.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w500)), fontWeight: FontWeight.w500)),
@ -124,7 +124,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
width: 200, width: 200,
height: 50, height: 50,
child: ElevatedButton( child: ElevatedButton(
key: Key('confirmStorage'), key: const Key('confirmStorage'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 12, elevation: 12,
primary: Colors primary: Colors
@ -133,7 +133,7 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
), ),
onPressed: (_generateWalletProvider onPressed: (_generateWalletProvider
.isAskedWordValid && .isAskedWordValid &&
this.walletName.text != '') walletName.text != '')
? () { ? () {
_generateWalletProvider.storeHDWChest( _generateWalletProvider.storeHDWChest(
generatedWallet, generatedWallet,
@ -154,12 +154,12 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
context, ModalRoute.withName('/')); context, ModalRoute.withName('/'));
} }
: null, : null,
child: Text('Confirmer', child: const Text('Confirmer',
style: TextStyle(fontSize: 28))), style: TextStyle(fontSize: 28))),
))), ))),
SizedBox(height: 70), const SizedBox(height: 70),
Text('TRICHE PENDANT ALPHA: ' + this._mnemonicController.text, Text('TRICHE PENDANT ALPHA: ' + _mnemonicController.text,
style: TextStyle( style: const TextStyle(
fontSize: 10.0, fontSize: 10.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.normal)), fontWeight: FontWeight.normal)),

View File

@ -1,7 +1,7 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/myWallets/confirmWalletStorage.dart'; import 'package:gecko/screens/myWallets/confirm_wallet_storage.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -15,8 +15,10 @@ class GenerateWalletsScreen extends StatelessWidget {
String currentText = ""; String currentText = "";
var pinColor = Colors.grey[300]; var pinColor = Colors.grey[300];
GlobalKey _toolTipSentence = GlobalKey(); final GlobalKey _toolTipSentence = GlobalKey();
GlobalKey _toolTipSecret = GlobalKey(); final GlobalKey _toolTipSecret = GlobalKey();
GenerateWalletsScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -27,18 +29,18 @@ class GenerateWalletsScreen extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Générer un trousseau'), child: Text('Générer un trousseau'),
)), )),
floatingActionButton: Container( floatingActionButton: SizedBox(
height: 80.0, height: 80.0,
width: 80.0, width: 80.0,
child: FittedBox( child: FittedBox(
child: FloatingActionButton( child: FloatingActionButton(
heroTag: "buttonGenerateWallet", heroTag: "buttonGenerateWallet",
onPressed: () => _generateWalletProvider.generateMnemonic(), onPressed: () => _generateWalletProvider.generateMnemonic(),
child: Container( child: SizedBox(
height: 40.0, height: 40.0,
width: 40.0, width: 40.0,
child: Icon(Icons.replay, color: Colors.grey[850]), child: Icon(Icons.replay, color: Colors.grey[850]),
@ -49,7 +51,7 @@ class GenerateWalletsScreen extends StatelessWidget {
body: Builder( body: Builder(
builder: (ctx) => SafeArea( builder: (ctx) => SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
toolTips(_toolTipSentence, 'Phrase de restauration:', toolTips(_toolTipSentence, 'Phrase de restauration:',
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"), "Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
TextField( TextField(
@ -57,45 +59,43 @@ class GenerateWalletsScreen extends StatelessWidget {
controller: _generateWalletProvider.mnemonicController, controller: _generateWalletProvider.mnemonicController,
maxLines: 3, maxLines: 3,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: const InputDecoration(
contentPadding: EdgeInsets.all(15.0), contentPadding: EdgeInsets.all(15.0),
), ),
style: TextStyle( style: const TextStyle(
fontSize: 22.0, fontSize: 22.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400)), fontWeight: FontWeight.w400)),
SizedBox(height: 8), const SizedBox(height: 8),
toolTips(_toolTipSecret, 'Code secret:', toolTips(_toolTipSecret, 'Code secret:',
"Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"), "Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"),
Container( Stack(
child: Stack( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, children: <Widget>[
children: <Widget>[ TextField(
TextField( key: const Key('generatedPin'),
key: Key('generatedPin'), enabled: false,
enabled: false, controller: _generateWalletProvider.pin,
controller: _generateWalletProvider.pin, maxLines: 1,
maxLines: 1, textAlign: TextAlign.center,
textAlign: TextAlign.center, decoration: const InputDecoration(),
decoration: InputDecoration(), style: const TextStyle(
style: TextStyle( fontSize: 30.0,
fontSize: 30.0, color: Colors.black,
color: Colors.black, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold)), IconButton(
IconButton( icon: const Icon(Icons.replay),
icon: Icon(Icons.replay), color: orangeC,
color: orangeC, onPressed: () {
onPressed: () { _generateWalletProvider.changePinCode(
_generateWalletProvider.changePinCode( reload: false);
reload: false); },
}, ),
), ],
],
),
), ),
SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
key: Key('storeKeychain'), key: const Key('storeKeychain'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: yellowC, // background primary: yellowC, // background
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
@ -117,9 +117,9 @@ class GenerateWalletsScreen extends StatelessWidget {
); );
} }
: null, : null,
child: Text('Enregistrer ce trousseau', child: const Text('Enregistrer ce trousseau',
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
SizedBox(height: 20), const SizedBox(height: 20),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
@ -130,7 +130,7 @@ class GenerateWalletsScreen extends StatelessWidget {
}), }),
); );
}, },
child: Icon(Icons.print)) child: const Icon(Icons.print))
]), ]),
))); )));
} }
@ -142,21 +142,21 @@ class GenerateWalletsScreen extends StatelessWidget {
_toolTip.ensureTooltipVisible(); _toolTip.ensureTooltipVisible();
}, },
child: Tooltip( child: Tooltip(
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
key: _key, key: _key,
showDuration: Duration(seconds: 5), showDuration: const Duration(seconds: 5),
message: _message, message: _message,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox(width: 20), const SizedBox(width: 20),
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox( SizedBox(
width: 30, width: 30,
height: 25, height: 25,
child: child:
Icon(Icons.info_outline, size: 22, color: orangeC)), Icon(Icons.info_outline, size: 22, color: orangeC)),
SizedBox(height: 1) const SizedBox(height: 1)
]), ]),
Text( Text(
_text, _text,
@ -165,14 +165,14 @@ class GenerateWalletsScreen extends StatelessWidget {
color: Colors.grey[600], color: Colors.grey[600],
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
), ),
SizedBox(width: 45) const SizedBox(width: 45)
]))); ])));
} }
} }
// ignore: must_be_immutable // ignore: must_be_immutable
class PrintWallet extends StatelessWidget { class PrintWallet extends StatelessWidget {
PrintWallet(this.sentence); const PrintWallet(this.sentence, {Key key}) : super(key: key);
final String sentence; final String sentence;
@ -182,7 +182,7 @@ class PrintWallet extends StatelessWidget {
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
appBar: AppBar(title: Text('Imprimer ce trousseau')), appBar: AppBar(title: const Text('Imprimer ce trousseau')),
body: PdfPreview( body: PdfPreview(
build: (format) => _generateWalletProvider.printWallet(sentence), build: (format) => _generateWalletProvider.printWallet(sentence),
), ),

View File

@ -1,13 +1,15 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class ImportWalletScreen extends StatelessWidget { class ImportWalletScreen extends StatelessWidget {
const ImportWalletScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -28,25 +30,24 @@ class ImportWalletScreen extends StatelessWidget {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
_generateWalletProvider.resetImportView(); _generateWalletProvider.resetImportView();
Navigator.of(context).pop(); Navigator.of(context).pop();
}), }),
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Importer un portefeuille'), child: Text('Importer un portefeuille'),
)), )),
body: Builder( body: Builder(
builder: (ctx) => SafeArea( builder: (ctx) => SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
TextFormField( TextFormField(
onChanged: (text) { onChanged: (text) {
if (_debounce?.isActive ?? false) if (_debounce?.isActive ?? false) {
// _generateWalletProvider.canImport = false;
// _generateWalletProvider.reloadBuild();
_debounce.cancel(); _debounce.cancel();
}
_debounce = _debounce =
Timer(const Duration(milliseconds: 200), () { Timer(const Duration(milliseconds: 200), () {
_generateWalletProvider _generateWalletProvider
@ -77,13 +78,12 @@ class ImportWalletScreen extends StatelessWidget {
), ),
), ),
), ),
SizedBox(height: 15), const SizedBox(height: 15),
TextFormField( TextFormField(
onChanged: (text) { onChanged: (text) {
if (_debounce?.isActive ?? false) if (_debounce?.isActive ?? false) {
// _generateWalletProvider.canImport = false;
// _generateWalletProvider.reloadBuild();
_debounce.cancel(); _debounce.cancel();
}
_debounce = _debounce =
Timer(const Duration(milliseconds: 200), () { Timer(const Duration(milliseconds: 200), () {
_generateWalletProvider _generateWalletProvider
@ -115,7 +115,7 @@ class ImportWalletScreen extends StatelessWidget {
), ),
), ),
), ),
SizedBox(height: 15), const SizedBox(height: 15),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Clipboard.setData(ClipboardData( Clipboard.setData(ClipboardData(
@ -125,41 +125,39 @@ class ImportWalletScreen extends StatelessWidget {
}, },
child: Text( child: Text(
_generateWalletProvider.cesiumPubkey.text, _generateWalletProvider.cesiumPubkey.text,
style: TextStyle( style: const TextStyle(
fontSize: 14.0, fontSize: 14.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Monospace'), fontFamily: 'Monospace'),
)), )),
SizedBox(height: 20), const SizedBox(height: 20),
toolTips(_toolTipSecret, 'Code secret:', toolTips(_toolTipSecret, 'Code secret:',
"Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"), "Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"),
Container( Stack(
child: Stack( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, children: <Widget>[
children: <Widget>[ TextField(
TextField( enabled: false,
enabled: false, controller: _generateWalletProvider.pin,
controller: _generateWalletProvider.pin, maxLines: 1,
maxLines: 1, textAlign: TextAlign.center,
textAlign: TextAlign.center, decoration: const InputDecoration(),
decoration: InputDecoration(), style: const TextStyle(
style: TextStyle( fontSize: 30.0,
fontSize: 30.0, color: Colors.black,
color: Colors.black, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold)), IconButton(
IconButton( icon: const Icon(Icons.replay),
icon: Icon(Icons.replay), color: orangeC,
color: orangeC, onPressed: () {
onPressed: () { _generateWalletProvider.changePinCode(
_generateWalletProvider.changePinCode( reload: true);
reload: true); },
}, ),
), ],
],
),
), ),
SizedBox(height: 30), const SizedBox(height: 30),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: yellowC, // background primary: yellowC, // background
@ -180,7 +178,7 @@ class ImportWalletScreen extends StatelessWidget {
}); });
} }
: null, : null,
child: Text('Importer ce portefeuille Cesium', child: const Text('Importer ce portefeuille Cesium',
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
]), ]),
)))); ))));
@ -193,21 +191,21 @@ class ImportWalletScreen extends StatelessWidget {
_toolTip.ensureTooltipVisible(); _toolTip.ensureTooltipVisible();
}, },
child: Tooltip( child: Tooltip(
padding: EdgeInsets.all(10), padding: const EdgeInsets.all(10),
key: _key, key: _key,
showDuration: Duration(seconds: 5), showDuration: const Duration(seconds: 5),
message: _message, message: _message,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox(width: 20), const SizedBox(width: 20),
Column(children: <Widget>[ Column(children: <Widget>[
SizedBox( SizedBox(
width: 30, width: 30,
height: 25, height: 25,
child: child:
Icon(Icons.info_outline, size: 22, color: orangeC)), Icon(Icons.info_outline, size: 22, color: orangeC)),
SizedBox(height: 1) const SizedBox(height: 1)
]), ]),
Text( Text(
_text, _text,
@ -216,7 +214,7 @@ class ImportWalletScreen extends StatelessWidget {
color: Colors.grey[600], color: Colors.grey[600],
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
), ),
SizedBox(width: 45) const SizedBox(width: 45)
]))); ])));
} }
} }

View File

@ -2,9 +2,9 @@ import 'dart:async';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/models/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -22,7 +22,7 @@ class UnlockingWallet extends StatelessWidget {
StreamController<ErrorAnimationType> errorController; StreamController<ErrorAnimationType> errorController;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
bool hasError = false; bool hasError = false;
var pinColor = Color(0xffF9F9F1); var pinColor = const Color(0xffF9F9F1);
var walletPin = ''; var walletPin = '';
String resultPay; String resultPay;
@ -42,11 +42,11 @@ class UnlockingWallet extends StatelessWidget {
// backgroundColor: Colors.brown[600], // backgroundColor: Colors.brown[600],
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
Expanded( Expanded(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 150), const SizedBox(height: 150),
Text( const Text(
'Veuillez tapper votre code secret pour dévérouiller votre portefeuille.', 'Veuillez tapper votre code secret pour dévérouiller votre portefeuille.',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -54,7 +54,7 @@ class UnlockingWallet extends StatelessWidget {
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
), ),
SizedBox(height: 50), const SizedBox(height: 50),
pinForm(context, _pinLenght, wallet.number, wallet.derivation), pinForm(context, _pinLenght, wallet.number, wallet.derivation),
]), ]),
), ),
@ -106,14 +106,14 @@ class UnlockingWallet extends StatelessWidget {
activeFillColor: hasError ? Colors.blueAccent : Colors.black, activeFillColor: hasError ? Colors.blueAccent : Colors.black,
), ),
cursorColor: Colors.black, cursorColor: Colors.black,
animationDuration: Duration(milliseconds: 300), animationDuration: const Duration(milliseconds: 300),
textStyle: TextStyle(fontSize: 20, height: 1.6), textStyle: const TextStyle(fontSize: 20, height: 1.6),
backgroundColor: Color(0xffF9F9F1), backgroundColor: const Color(0xffF9F9F1),
enableActiveFill: false, enableActiveFill: false,
errorAnimationController: errorController, errorAnimationController: errorController,
controller: _enterPin, controller: _enterPin,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
boxShadows: [ boxShadows: const [
BoxShadow( BoxShadow(
offset: Offset(0, 1), offset: Offset(0, 1),
color: Colors.black12, color: Colors.black12,
@ -124,7 +124,7 @@ class UnlockingWallet extends StatelessWidget {
log.d("Completed"); log.d("Completed");
_myWalletProvider.pinCode = _pin; _myWalletProvider.pinCode = _pin;
final resultWallet = await _walletOptions.readLocalWallet( final resultWallet = await _walletOptions.readLocalWallet(
context, this.wallet, _pin.toUpperCase(), _pinLenght); context, wallet, _pin.toUpperCase(), _pinLenght);
// _myWalletProvider.pinCode = _pin.toUpperCase(); // _myWalletProvider.pinCode = _pin.toUpperCase();
_myWalletProvider.pinLenght = _pinLenght; _myWalletProvider.pinLenght = _pinLenght;
@ -140,7 +140,6 @@ class UnlockingWallet extends StatelessWidget {
if (action == "mywallets") { if (action == "mywallets") {
Navigator.pushNamed(formKey.currentContext, '/mywallets'); Navigator.pushNamed(formKey.currentContext, '/mywallets');
} else if (action == "pay") { } else if (action == "pay") {
print("Go payments");
resultPay = resultPay =
await _historyProvider.pay(context, _pin.toUpperCase()); await _historyProvider.pay(context, _pin.toUpperCase());
await _paymentsResult(context); await _paymentsResult(context);
@ -148,8 +147,8 @@ class UnlockingWallet extends StatelessWidget {
} }
}, },
onChanged: (value) { onChanged: (value) {
if (pinColor != Color(0xFFA4B600)) { if (pinColor != const Color(0xFFA4B600)) {
pinColor = Color(0xFFA4B600); pinColor = const Color(0xFFA4B600);
} }
}, },
)), )),
@ -165,10 +164,10 @@ class UnlockingWallet extends StatelessWidget {
title: Text(resultPay == "Success" title: Text(resultPay == "Success"
? 'Paiement effecuté avec succès !' ? 'Paiement effecuté avec succès !'
: "Une erreur s'est produite lors du paiement"), : "Une erreur s'est produite lors du paiement"),
content: SingleChildScrollView(child: Text('')), content: const SingleChildScrollView(child: Text('')),
actions: <Widget>[ actions: <Widget>[
TextButton( TextButton(
child: Text("OK"), child: const Text("OK"),
onPressed: () { onPressed: () {
Navigator.popUntil( Navigator.popUntil(
context, context,

View File

@ -3,10 +3,10 @@ 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/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/queries.dart'; import 'package:gecko/models/queries.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -42,8 +42,9 @@ class WalletOptions extends StatelessWidget {
_walletOptions.nameController.text.length >= 15 _walletOptions.nameController.text.length >= 15
? _nbrLinesName = 2 ? _nbrLinesName = 2
: _nbrLinesName = 1; : _nbrLinesName = 1;
if (_walletOptions.nameController.text.length >= 26 && isTall) if (_walletOptions.nameController.text.length >= 26 && isTall) {
_nbrLinesName = 3; _nbrLinesName = 3;
}
_walletOptions.walletID = [0, wallet.number]; _walletOptions.walletID = [0, wallet.number];
@ -71,7 +72,7 @@ class WalletOptions extends StatelessWidget {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
_walletOptions.isEditing = false; _walletOptions.isEditing = false;
_walletOptions.isBalanceBlur = true; _walletOptions.isBalanceBlur = true;
@ -98,11 +99,11 @@ class WalletOptions extends StatelessWidget {
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
colors: [ colors: [
yellowC, yellowC,
Color(0xfffafafa), const Color(0xfffafafa),
], ],
)), )),
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 25), const SizedBox(width: 25),
InkWell( InkWell(
onTap: () async { onTap: () async {
await _walletOptions.changeAvatar(); await _walletOptions.changeAvatar();
@ -119,7 +120,7 @@ class WalletOptions extends StatelessWidget {
Image.asset( Image.asset(
'assets/walletOptions/camera.png', 'assets/walletOptions/camera.png',
), ),
SizedBox(height: 100) const SizedBox(height: 100)
])), ])),
Column(children: <Widget>[ Column(children: <Widget>[
Row(children: <Widget>[ Row(children: <Widget>[
@ -127,14 +128,14 @@ class WalletOptions extends StatelessWidget {
SizedBox( SizedBox(
width: 260, width: 260,
child: TextField( child: TextField(
key: Key('walletName'), key: const Key('walletName'),
autofocus: false, autofocus: false,
focusNode: _walletOptions.walletNameFocus, focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing, enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController, controller: _walletOptions.nameController,
maxLines: _nbrLinesName, maxLines: _nbrLinesName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: const InputDecoration(
border: InputBorder.none, border: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
@ -163,7 +164,7 @@ class WalletOptions extends StatelessWidget {
} }
if (result.isLoading) { if (result.isLoading) {
return Text('Loading'); return const Text('Loading');
} }
// List repositories = result.data['viewer']['repositories']['nodes']; // List repositories = result.data['viewer']['repositories']['nodes'];
@ -190,7 +191,7 @@ class WalletOptions extends StatelessWidget {
sigmaY: _walletOptions.isBalanceBlur sigmaY: _walletOptions.isBalanceBlur
? 5 ? 5
: 0), : 0),
child: Text('$wBalanceUD', child: Text(wBalanceUD,
style: TextStyle( style: TextStyle(
fontSize: isTall ? 20 : 18, fontSize: isTall ? 20 : 18,
color: Colors.black)), color: Colors.black)),
@ -208,9 +209,9 @@ class WalletOptions extends StatelessWidget {
// ); // );
}, },
), ),
SizedBox(height: 5), const SizedBox(height: 5),
InkWell( InkWell(
key: Key('displayBalance'), key: const Key('displayBalance'),
onTap: () { onTap: () {
_walletOptions.bluringBalance(); _walletOptions.bluringBalance();
}, },
@ -220,15 +221,15 @@ class WalletOptions extends StatelessWidget {
: 'assets/walletOptions/icon_oeuil_close.png', : 'assets/walletOptions/icon_oeuil_close.png',
)), )),
]), ]),
SizedBox(width: 0), const SizedBox(width: 0),
Column(children: <Widget>[ Column(children: <Widget>[
InkWell( InkWell(
key: Key('renameWallet'), key: const Key('renameWallet'),
onTap: () async { onTap: () async {
_isNewNameValid = _walletOptions _isNewNameValid = _walletOptions
.editWalletName(_walletOptions.walletID); .editWalletName(_walletOptions.walletID);
await Future.delayed( await Future.delayed(
Duration(milliseconds: 30)); const Duration(milliseconds: 30));
_walletOptions.walletNameFocus.requestFocus(); _walletOptions.walletNameFocus.requestFocus();
}, },
child: ClipRRect( child: ClipRRect(
@ -239,7 +240,7 @@ class WalletOptions extends StatelessWidget {
width: 20, width: 20,
height: 20), height: 20),
)), )),
SizedBox( const SizedBox(
height: 60, height: 60,
) )
]) ])
@ -254,11 +255,11 @@ class WalletOptions extends StatelessWidget {
return snapshot.data != null return snapshot.data != null
? Image.memory(snapshot.data, ? Image.memory(snapshot.data,
height: isTall ? 300 : 270) height: isTall ? 300 : 270)
: Text('-', style: TextStyle(fontSize: 20)); : const Text('-', style: TextStyle(fontSize: 20));
}), }),
SizedBox(height: 15 * ratio), SizedBox(height: 15 * ratio),
GestureDetector( GestureDetector(
key: Key('copyPubkey'), key: const Key('copyPubkey'),
onTap: () { onTap: () {
Clipboard.setData( Clipboard.setData(
ClipboardData(text: _walletOptions.pubkey.text)); ClipboardData(text: _walletOptions.pubkey.text));
@ -267,30 +268,29 @@ class WalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/key.png', 'assets/walletOptions/key.png',
), ),
SizedBox(width: 10), const SizedBox(width: 10),
Text("${shortPubkey.split(':')[0]}:", Text("${shortPubkey.split(':')[0]}:",
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace', fontFamily: 'Monospace',
color: Colors.black)), color: Colors.black)),
Text(shortPubkey.split(':')[1], Text(shortPubkey.split(':')[1],
style: TextStyle( style: const TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontFamily: 'Monospace')), fontFamily: 'Monospace')),
SizedBox(width: 15), const SizedBox(width: 15),
SizedBox( SizedBox(
height: 40, height: 40,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius: BorderRadius.circular(8),
new BorderRadius.circular(8),
), ),
elevation: 1, elevation: 1,
primary: orangeC, // background primary: orangeC, // background
@ -305,7 +305,7 @@ class WalletOptions extends StatelessWidget {
Image.asset( Image.asset(
'assets/walletOptions/copy-white.png', 'assets/walletOptions/copy-white.png',
), ),
SizedBox(width: 7), const SizedBox(width: 7),
Text('Copier', Text('Copier',
style: TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
@ -314,7 +314,7 @@ class WalletOptions extends StatelessWidget {
]))), ]))),
SizedBox(height: 10 * ratio), SizedBox(height: 10 * ratio),
InkWell( InkWell(
key: Key('displayHistory'), key: const Key('displayHistory'),
onTap: () { onTap: () {
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text, _historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
goHistory: true); goHistory: true);
@ -322,18 +322,18 @@ class WalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/clock.png', 'assets/walletOptions/clock.png',
), ),
SizedBox(width: 12), const SizedBox(width: 12),
Text('Historique des transactions', const Text('Historique des transactions',
style: style:
TextStyle(fontSize: 20, color: Colors.black)), TextStyle(fontSize: 20, color: Colors.black)),
]))), ]))),
SizedBox(height: 12 * ratio), SizedBox(height: 12 * ratio),
InkWell( InkWell(
key: Key('setDefaultWallet'), key: const Key('setDefaultWallet'),
onTap: !_walletOptions.isDefaultWallet onTap: !_walletOptions.isDefaultWallet
? () { ? () {
defaultWallet = wallet; defaultWallet = wallet;
@ -346,14 +346,14 @@ class WalletOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 31), const SizedBox(width: 31),
CircleAvatar( CircleAvatar(
backgroundColor: Colors.grey[ backgroundColor: Colors.grey[
_walletOptions.isDefaultWallet ? 300 : 500], _walletOptions.isDefaultWallet ? 300 : 500],
child: Image.asset( child: Image.asset(
'assets/walletOptions/android-checkmark.png', 'assets/walletOptions/android-checkmark.png',
)), )),
SizedBox(width: 12), const SizedBox(width: 12),
Text( Text(
_walletOptions.isDefaultWallet _walletOptions.isDefaultWallet
? 'Ce portefeuille est celui par defaut' ? 'Ce portefeuille est celui par defaut'
@ -367,7 +367,7 @@ class WalletOptions extends StatelessWidget {
SizedBox(height: 17 * ratio), SizedBox(height: 17 * ratio),
if (!_walletOptions.isDefaultWallet) if (!_walletOptions.isDefaultWallet)
InkWell( InkWell(
key: Key('deleteWallet'), key: const Key('deleteWallet'),
onTap: !_walletOptions.isDefaultWallet onTap: !_walletOptions.isDefaultWallet
? () async { ? () async {
await _walletOptions.deleteWallet( await _walletOptions.deleteWallet(
@ -381,12 +381,12 @@ class WalletOptions extends StatelessWidget {
} }
: null, : null,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
SizedBox(width: 33), const SizedBox(width: 33),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
), ),
SizedBox(width: 14), const SizedBox(width: 14),
Text('Supprimer ce portefeuille', const Text('Supprimer ce portefeuille',
style: TextStyle( style: TextStyle(
fontSize: 20, color: Color(0xffD80000))), fontSize: 20, color: Color(0xffD80000))),
])), ])),

View File

@ -1,21 +1,23 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/chestData.dart'; import 'package:gecko/models/chest_data.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/queries.dart'; import 'package:gecko/models/queries.dart';
import 'package:gecko/models/walletData.dart'; import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/myWallets/chooseChest.dart'; import 'package:gecko/screens/myWallets/choose_chest.dart';
import 'package:gecko/screens/myWallets/walletOptions.dart'; import 'package:gecko/screens/myWallets/wallet_options.dart';
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart'; import 'package:gecko/screens/onBoarding/0_no_keychain_found.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class WalletsHome extends StatelessWidget { class WalletsHome extends StatelessWidget {
final _derivationKey = GlobalKey<FormState>(); final _derivationKey = GlobalKey<FormState>();
WalletsHome({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -43,7 +45,7 @@ class WalletsHome extends StatelessWidget {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black), icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () { onPressed: () {
Navigator.popUntil( Navigator.popUntil(
context, context,
@ -51,12 +53,13 @@ class WalletsHome extends StatelessWidget {
); );
}), }),
title: Text(_currentChest.name, title: Text(_currentChest.name,
key: Key('myWallets'), style: TextStyle(color: Colors.grey[850])), key: const Key('myWallets'),
backgroundColor: Color(0xffFFD58D), style: TextStyle(color: Colors.grey[850])),
backgroundColor: const Color(0xffFFD58D),
), ),
body: SafeArea( body: SafeArea(
child: !isWalletsExists child: !isWalletsExists
? NoKeyChainScreen() ? const NoKeyChainScreen()
: _currentChest.isCesium : _currentChest.isCesium
? cesiumWalletOptions(context) ? cesiumWalletOptions(context)
: myWalletsTiles(context), : myWalletsTiles(context),
@ -66,14 +69,14 @@ class WalletsHome extends StatelessWidget {
} }
Widget cesiumWalletOptions(BuildContext context) { Widget cesiumWalletOptions(BuildContext context) {
return Column(children: [ return Column(children: const [
Center(child: Text('This is a Cesium wallet')), Center(child: Text('This is a Cesium wallet')),
]); ]);
} }
Widget chestOptions(BuildContext context) { Widget chestOptions(BuildContext context) {
return Column(children: [ return Column(children: [
SizedBox(height: 50), const SizedBox(height: 50),
SizedBox( SizedBox(
height: 120, height: 120,
width: 445, width: 445,
@ -87,7 +90,7 @@ class WalletsHome extends StatelessWidget {
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () => null, onPressed: () => null,
label: Text( label: const Text(
" Paramétrer ce coffre", " Paramétrer ce coffre",
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
@ -96,7 +99,7 @@ class WalletsHome extends StatelessWidget {
), ),
), ),
)), )),
SizedBox(height: 30), const SizedBox(height: 30),
SizedBox( SizedBox(
height: 120, height: 120,
width: 445, width: 445,
@ -113,7 +116,7 @@ class WalletsHome extends StatelessWidget {
return ChooseChest(); return ChooseChest();
}), }),
), ),
label: Text( label: const Text(
" Changer de coffre", " Changer de coffre",
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
@ -122,7 +125,7 @@ class WalletsHome extends StatelessWidget {
), ),
), ),
)), )),
SizedBox(height: 30) const SizedBox(height: 30)
]); ]);
} }
@ -135,12 +138,12 @@ class WalletsHome extends StatelessWidget {
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist(); final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
if (!isWalletsExists) { if (!isWalletsExists) {
return Text(''); return const Text('');
} }
if (_myWalletProvider.listWallets.isEmpty) { if (_myWalletProvider.listWallets.isEmpty) {
return Expanded( return Expanded(
child: Column(children: <Widget>[ child: Column(children: const <Widget>[
Center( Center(
child: Text( child: Text(
'Veuillez générer votre premier portefeuille', 'Veuillez générer votre premier portefeuille',
@ -154,9 +157,9 @@ class WalletsHome extends StatelessWidget {
_myWalletProvider.getDefaultWallet(configBox.get('currentChest')); _myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
return CustomScrollView(slivers: <Widget>[ return CustomScrollView(slivers: <Widget>[
SliverToBoxAdapter(child: SizedBox(height: 20)), const SliverToBoxAdapter(child: SizedBox(height: 20)),
SliverGrid.count( SliverGrid.count(
key: Key('listWallets'), key: const Key('listWallets'),
crossAxisCount: 2, crossAxisCount: 2,
childAspectRatio: 1, childAspectRatio: 1,
crossAxisSpacing: 0, crossAxisSpacing: 0,
@ -164,7 +167,7 @@ class WalletsHome extends StatelessWidget {
children: <Widget>[ children: <Widget>[
for (WalletData _repository in _listWallets) for (WalletData _repository in _listWallets)
Padding( Padding(
padding: EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
await _walletOptions.readLocalWallet( await _walletOptions.readLocalWallet(
@ -185,14 +188,15 @@ class WalletsHome extends StatelessWidget {
// })); // }));
}, },
child: ClipOvalShadow( child: ClipOvalShadow(
shadow: Shadow( shadow: const Shadow(
color: Colors.transparent, color: Colors.transparent,
offset: Offset(0, 0), offset: Offset(0, 0),
blurRadius: 5, blurRadius: 5,
), ),
clipper: CustomClipperOval(), clipper: CustomClipperOval(),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius:
const BorderRadius.all(Radius.circular(12)),
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Expanded( Expanded(
child: Container( child: Container(
@ -203,7 +207,7 @@ class WalletsHome extends StatelessWidget {
radius: 0.6, radius: 0.6,
colors: [ colors: [
Colors.green[400], Colors.green[400],
Color(0xFFE7E7A6), const Color(0xFFE7E7A6),
], ],
)), )),
child: child:
@ -217,29 +221,30 @@ class WalletsHome extends StatelessWidget {
)), )),
// balanceBuilder(context, _walletOptions.pubkey.text), // balanceBuilder(context, _walletOptions.pubkey.text),
ListTile( ListTile(
shape: RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.vertical(
bottom: Radius.circular(12))), bottom: Radius.circular(12))),
// contentPadding: const EdgeInsets.only(left: 7.0), // contentPadding: const EdgeInsets.only(left: 7.0),
tileColor: tileColor:
_repository.id()[1] == defaultWallet.id()[1] _repository.id()[1] == defaultWallet.id()[1]
? orangeC ? orangeC
: Color(0xffFFD58D), : const Color(0xffFFD58D),
// leading: Text('IMAGE'), // leading: Text('IMAGE'),
// subtitle: Text(_repository.split(':')[3], // subtitle: Text(_repository.split(':')[3],
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')), // style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
title: Center( title: Center(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5), padding:
const EdgeInsets.symmetric(horizontal: 5),
child: Text( child: Text(
'${_repository.name}', _repository.name,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 17.0, fontSize: 17.0,
color: _repository.id()[1] == color: _repository.id()[1] ==
defaultWallet.id()[1] defaultWallet.id()[1]
? Color(0xffF9F9F1) ? const Color(0xffF9F9F1)
: Colors.black, : Colors.black,
fontStyle: FontStyle.italic), fontStyle: FontStyle.italic),
), ),
@ -292,7 +297,7 @@ class WalletsHome extends StatelessWidget {
} }
if (result.isLoading) { if (result.isLoading) {
return Text('Loading'); return const Text('Loading');
} }
String wBalanceUD; String wBalanceUD;
if (result.data['balance'] == null) { if (result.data['balance'] == null) {
@ -310,13 +315,13 @@ class WalletsHome extends StatelessWidget {
Widget addNewDerivation(context) { Widget addNewDerivation(context) {
return Padding( return Padding(
padding: EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: const BorderRadius.all(Radius.circular(12)),
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Expanded( Expanded(
child: InkWell( child: InkWell(
key: Key('addDerivation'), key: const Key('addDerivation'),
onTap: () { onTap: () {
showDialog( showDialog(
context: context, context: context,
@ -328,7 +333,7 @@ class WalletsHome extends StatelessWidget {
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
decoration: BoxDecoration(color: floattingYellow), decoration: BoxDecoration(color: floattingYellow),
child: Center( child: const Center(
child: Text( child: Text(
'+', '+',
style: TextStyle( style: TextStyle(
@ -355,21 +360,21 @@ class WalletsHome extends StatelessWidget {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text('Nom du portefeuille:'), const Text('Nom du portefeuille:'),
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextFormField( child: TextFormField(
key: Key('DerivationNameKey'), key: const Key('DerivationNameKey'),
controller: _newDerivationName, controller: _newDerivationName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
autofocus: true, autofocus: true,
), ),
), ),
SizedBox(height: 20), const SizedBox(height: 20),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: ElevatedButton( child: ElevatedButton(
key: Key('validDerivation'), key: const Key('validDerivation'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 1, elevation: 1,
primary: yellowC, // background primary: yellowC, // background
@ -381,7 +386,7 @@ class WalletsHome extends StatelessWidget {
context, _newDerivationName.text) context, _newDerivationName.text)
.then((_) => _newDerivationName.text == ''); .then((_) => _newDerivationName.text == '');
}, },
child: Text("Créer")), child: const Text("Créer")),
) )
], ],
), ),
@ -402,7 +407,7 @@ class CustomClipperOval extends CustomClipper<Rect> {
@override @override
Rect getClip(Size size) { Rect getClip(Size size) {
return Rect.fromCircle( return Rect.fromCircle(
center: new Offset(size.width / 2, size.width / 2), center: Offset(size.width / 2, size.width / 2),
radius: size.width / 2 + 3); radius: size.width / 2 + 3);
} }
@ -417,20 +422,21 @@ class ClipOvalShadow extends StatelessWidget {
final CustomClipper<Rect> clipper; final CustomClipper<Rect> clipper;
final Widget child; final Widget child;
ClipOvalShadow({ const ClipOvalShadow({
Key key,
@required this.shadow, @required this.shadow,
@required this.clipper, @required this.clipper,
@required this.child, @required this.child,
}); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CustomPaint( return CustomPaint(
painter: _ClipOvalShadowPainter( painter: _ClipOvalShadowPainter(
clipper: this.clipper, clipper: clipper,
shadow: this.shadow, shadow: shadow,
), ),
child: ClipRect(child: child, clipper: this.clipper), child: ClipRect(child: child, clipper: clipper),
); );
} }
} }
@ -444,7 +450,7 @@ class _ClipOvalShadowPainter extends CustomPainter {
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
var paint = shadow.toPaint(); var paint = shadow.toPaint();
var clipRect = clipper.getClip(size).shift(Offset(0, 0)); var clipRect = clipper.getClip(size).shift(const Offset(0, 0));
canvas.drawOval(clipRect, paint); canvas.drawOval(clipRect, paint);
} }

View File

@ -1,16 +1,14 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/myWallets/importWallet.dart'; import 'package:gecko/screens/myWallets/import_wallet.dart';
import 'package:gecko/screens/onBoarding/1.dart'; import 'package:gecko/screens/onBoarding/1.dart';
// import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart';
// ignore: must_be_immutable
class NoKeyChainScreen extends StatelessWidget { class NoKeyChainScreen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); const NoKeyChainScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -25,16 +23,16 @@ class NoKeyChainScreen extends StatelessWidget {
common.onboardingProgressBar(context, 'Mes portefeuilles', 0), common.onboardingProgressBar(context, 'Mes portefeuilles', 0),
common.bubbleSpeak( common.bubbleSpeak(
"Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.", "Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.",
textKey: Key('textOnboarding')), textKey: const Key('textOnboarding')),
SizedBox(height: 90), const SizedBox(height: 90),
Container( Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(0xffFFD58D), // button color
child: InkWell( child: InkWell(
key: Key('goStep1'), key: const Key('goStep1'),
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: const Padding(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),
child: Image( child: Image(
image: AssetImage('assets/onBoarding/wallet.png'), image: AssetImage('assets/onBoarding/wallet.png'),
@ -47,7 +45,7 @@ class NoKeyChainScreen extends StatelessWidget {
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -59,8 +57,8 @@ class NoKeyChainScreen extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 15), const SizedBox(height: 15),
Text( const Text(
"Créer un nouveau\nportefeuille", "Créer un nouveau\nportefeuille",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -68,15 +66,15 @@ class NoKeyChainScreen extends StatelessWidget {
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
), ),
SizedBox(height: 70), const SizedBox(height: 70),
Container( Container(
child: ClipOval( child: ClipOval(
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: const Color(0xffFFD58D), // button color
child: InkWell( child: InkWell(
splashColor: orangeC, // inkwell color splashColor: orangeC, // inkwell color
child: Padding( child: Padding(
padding: EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: child:
// Image( // Image(
// image: AssetImage('assets/cesium_bw3.png'), // image: AssetImage('assets/cesium_bw3.png'),
@ -86,11 +84,11 @@ class NoKeyChainScreen extends StatelessWidget {
), ),
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
SlideLeftRoute(page: ImportWalletScreen())); SlideLeftRoute(page: const ImportWalletScreen()));
}), }),
), ),
), ),
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.white, color: Colors.white,
boxShadow: [ boxShadow: [
@ -102,8 +100,8 @@ class NoKeyChainScreen extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 10), const SizedBox(height: 10),
Text( const Text(
"Importer un\nportefeuille Cesium", "Importer un\nportefeuille Cesium",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 13), style: TextStyle(color: Colors.black, fontSize: 13),

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/2.dart'; import 'package:gecko/screens/onBoarding/2.dart';
// import 'package:gecko/models/home.dart'; // import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
@ -11,6 +13,8 @@ class OnboardingStepOne extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 1; final int progress = 1;
OnboardingStepOne({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -24,8 +28,8 @@ class OnboardingStepOne extends StatelessWidget {
context, 'Nouveau portefeuilles', progress), context, 'Nouveau portefeuilles', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Il semblerait que vous nayez pas encore de trousseau.\n\nUn trousseau vous permet de gérer un ou plusieurs portefeuilles.", "Il semblerait que vous nayez pas encore de trousseau.\n\nUn trousseau vous permet de gérer un ou plusieurs portefeuilles.",
textKey: Key('step1')), textKey: const Key('step1')),
SizedBox(height: 90), const SizedBox(height: 90),
Image.asset( Image.asset(
'assets/onBoarding/keys-and-wallets-horizontal.png', 'assets/onBoarding/keys-and-wallets-horizontal.png',
height: 200, height: 200,
@ -37,7 +41,7 @@ class OnboardingStepOne extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep2'), key: const Key('goStep2'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,10 +53,10 @@ class OnboardingStepOne extends StatelessWidget {
FaderTransition( FaderTransition(
page: OnboardingStepTwo(), isFast: true)); page: OnboardingStepTwo(), isFast: true));
}, },
child: Text('Créer mon trousseau', child: const Text('Créer mon trousseau',
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/11.dart'; import 'package:gecko/screens/onBoarding/11.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepTwelve extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 9; final int progress = 9;
OnboardingStepTwelve({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,9 +26,9 @@ class OnboardingStepTwelve extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Si un jour vous changez de téléphone, votre code secret sera différent, mais il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.", "Si un jour vous changez de téléphone, votre code secret sera différent, mais il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.",
textKey: Key('step10'), textKey: const Key('step10'),
), ),
SizedBox(height: 10), const SizedBox(height: 10),
Image.asset( Image.asset(
'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png', 'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png',
height: 410 * ratio, height: 410 * ratio,
@ -36,7 +40,7 @@ class OnboardingStepTwelve extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep11'), key: const Key('goStep11'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,7 +53,7 @@ class OnboardingStepTwelve extends StatelessWidget {
page: OnboardingStepThirteen(), isFast: true), page: OnboardingStepThirteen(), isFast: true),
); );
}, },
child: Text("Générer le code secret", child: const Text("Générer le code secret",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: isTall ? 80 : 40), SizedBox(height: isTall ? 80 : 40),

View File

@ -1,10 +1,12 @@
// ignore_for_file: file_names
import 'dart:ui'; import 'dart:ui';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.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/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/12.dart'; import 'package:gecko/screens/onBoarding/12.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -13,6 +15,8 @@ class OnboardingStepThirteen extends StatelessWidget {
NewWallet generatedWallet; NewWallet generatedWallet;
final int progress = 10; final int progress = 10;
OnboardingStepThirteen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -32,51 +36,49 @@ class OnboardingStepThirteen extends StatelessWidget {
// initialData: '...', // initialData: '...',
builder: (context, snapshot) { builder: (context, snapshot) {
generatedWallet = snapshot.data; generatedWallet = snapshot.data;
return Visibility(visible: false, child: Text('')); return const Visibility(visible: false, child: Text(''));
}), }),
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich( common.bubbleSpeakRich(
<TextSpan>[ <TextSpan>[
TextSpan( const TextSpan(
text: text:
"Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "), "Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "),
TextSpan( const TextSpan(
text: 'à chaque fois', text: 'à chaque fois',
style: TextStyle(fontWeight: FontWeight.bold)), style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan( const TextSpan(
text: text:
" que vous voudrez effectuer un paiement sur cet appareil."), " que vous voudrez effectuer un paiement sur cet appareil."),
], ],
textKey: Key('step11'), textKey: const Key('step11'),
), ),
SizedBox(height: 100), const SizedBox(height: 100),
Container( Stack(
child: Stack( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, children: <Widget>[
children: <Widget>[ TextField(
TextField( key: const Key('generatedPin'),
key: Key('generatedPin'), enabled: false,
enabled: false, controller: _generateWalletProvider.pin,
controller: _generateWalletProvider.pin, maxLines: 1,
maxLines: 1, textAlign: TextAlign.center,
textAlign: TextAlign.center, decoration: const InputDecoration(),
decoration: InputDecoration(), style: const TextStyle(
style: TextStyle( letterSpacing: 5,
letterSpacing: 5, fontSize: 35.0,
fontSize: 35.0, color: Colors.black,
color: Colors.black, fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold)), IconButton(
IconButton( icon: const Icon(Icons.replay),
icon: Icon(Icons.replay), color: orangeC,
color: orangeC, onPressed: () async {
onPressed: () async { generatedWallet = await _generateWalletProvider
generatedWallet = await _generateWalletProvider .changePinCode(reload: false);
.changePinCode(reload: false); },
}, ),
), ],
],
),
), ),
Expanded( Expanded(
child: Align( child: Align(
@ -85,25 +87,25 @@ class OnboardingStepThirteen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('changeSecretCode'), key: const Key('changeSecretCode'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffFFD58D), primary: const Color(0xffFFD58D),
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () async { onPressed: () async {
generatedWallet = await _generateWalletProvider generatedWallet = await _generateWalletProvider
.changePinCode(reload: false); .changePinCode(reload: false);
}, },
child: Text("Choisir un autre code secret", child: const Text("Choisir un autre code secret",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 25), const SizedBox(height: 25),
SizedBox( SizedBox(
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep12'), key: const Key('goStep12'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -120,10 +122,10 @@ class OnboardingStepThirteen extends StatelessWidget {
isFast: true), isFast: true),
); );
}, },
child: Text("J'ai noté mon code secret", child: const Text("J'ai noté mon code secret",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
), ),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,13 +1,15 @@
// ignore_for_file: file_names
import 'dart:async'; import 'dart:async';
import 'dart:ui'; import 'dart:ui';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.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/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/models/walletOptions.dart'; import 'package:gecko/models/wallet_options.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/13_congratulations.dart'; import 'package:gecko/screens/onBoarding/13_congratulations.dart';
import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -22,7 +24,7 @@ class OnboardingStepFourteen extends StatelessWidget {
NewWallet generatedWallet; NewWallet generatedWallet;
final int progress = 11; final int progress = 11;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
var pinColor = Color(0xFFA4B600); var pinColor = const Color(0xFFA4B600);
bool hasError = false; bool hasError = false;
@override @override
@ -43,7 +45,7 @@ class OnboardingStepFourteen extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Avez-vous bien mémorisé votre code secret ?\n\nVérifions ça ensemble !\n\nTapez votre code secret dans le champ ci-dessous (après cest fini, promis-juré-gecko).", "Avez-vous bien mémorisé votre code secret ?\n\nVérifions ça ensemble !\n\nTapez votre code secret dans le champ ci-dessous (après cest fini, promis-juré-gecko).",
textKey: Key('step12'), textKey: const Key('step12'),
), ),
SizedBox(height: isTall ? 80 : 10), SizedBox(height: isTall ? 80 : 10),
pinForm(context, _walletOptions, _pinLenght, 1, 3) pinForm(context, _walletOptions, _pinLenght, 1, 3)
@ -70,7 +72,7 @@ class OnboardingStepFourteen extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30), padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30),
child: PinCodeTextField( child: PinCodeTextField(
key: Key('formKey2'), key: const Key('formKey2'),
autoFocus: true, autoFocus: true,
appContext: context, appContext: context,
pastedTextStyle: TextStyle( pastedTextStyle: TextStyle(
@ -98,14 +100,14 @@ class OnboardingStepFourteen extends StatelessWidget {
activeFillColor: hasError ? Colors.blueAccent : Colors.black, activeFillColor: hasError ? Colors.blueAccent : Colors.black,
), ),
cursorColor: Colors.black, cursorColor: Colors.black,
animationDuration: Duration(milliseconds: 300), animationDuration: const Duration(milliseconds: 300),
textStyle: TextStyle(fontSize: 20, height: 1.6), textStyle: const TextStyle(fontSize: 20, height: 1.6),
backgroundColor: Color(0xffF9F9F1), backgroundColor: const Color(0xffF9F9F1),
enableActiveFill: false, enableActiveFill: false,
errorAnimationController: errorController, errorAnimationController: errorController,
controller: _enterPin, controller: _enterPin,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
boxShadows: [ boxShadows: const [
BoxShadow( BoxShadow(
offset: Offset(0, 1), offset: Offset(0, 1),
color: Colors.black12, color: Colors.black12,
@ -140,8 +142,8 @@ class OnboardingStepFourteen extends StatelessWidget {
} }
}, },
onChanged: (value) { onChanged: (value) {
if (pinColor != Color(0xFFA4B600)) { if (pinColor != const Color(0xFFA4B600)) {
pinColor = Color(0xFFA4B600); pinColor = const Color(0xFFA4B600);
} }
}, },
)), )),

View File

@ -1,13 +1,17 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class OnboardingStepFiveteen extends StatelessWidget { class OnboardingStepFiveteen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 12; final int progress = 12;
OnboardingStepFiveteen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -21,7 +25,7 @@ class OnboardingStepFiveteen extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !", "Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !",
textKey: Key('step13'), textKey: const Key('step13'),
), ),
SizedBox(height: isTall ? 20 : 10), SizedBox(height: isTall ? 20 : 10),
Image.asset( Image.asset(
@ -35,7 +39,7 @@ class OnboardingStepFiveteen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goWalletHome'), key: const Key('goWalletHome'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -51,10 +55,10 @@ class OnboardingStepFiveteen extends StatelessWidget {
'/mywallets', '/mywallets',
); );
}, },
child: Text("Accéder à mes portefeuilles", child: const Text("Accéder à mes portefeuilles",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/3.dart'; import 'package:gecko/screens/onBoarding/3.dart';
// import 'package:gecko/screens/commonElements.dart'; // import 'package:gecko/screens/commonElements.dart';
// import 'package:gecko/models/home.dart'; // import 'package:gecko/models/home.dart';
@ -12,6 +14,8 @@ class OnboardingStepTwo extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 2; final int progress = 2;
OnboardingStepTwo({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -25,9 +29,9 @@ class OnboardingStepTwo extends StatelessWidget {
context, 'Nouveau portefeuilles', progress), context, 'Nouveau portefeuilles', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Un trousseau est créé à partir dune phrase de restauration.", "Un trousseau est créé à partir dune phrase de restauration.",
textKey: Key('step2'), textKey: const Key('step2'),
), ),
SizedBox(height: 70), const SizedBox(height: 70),
Image.asset( Image.asset(
'assets/onBoarding/keys-and-wallets-horizontal-plus-phrase.png'), 'assets/onBoarding/keys-and-wallets-horizontal-plus-phrase.png'),
Expanded( Expanded(
@ -37,7 +41,7 @@ class OnboardingStepTwo extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep3'), key: const Key('goStep3'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -50,10 +54,11 @@ class OnboardingStepTwo extends StatelessWidget {
page: OnboardingStepFor(), isFast: true), page: OnboardingStepFor(), isFast: true),
); );
}, },
child: Text("D'accord", style: TextStyle(fontSize: 20)), child: const Text("D'accord",
style: TextStyle(fontSize: 20)),
), ),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/4.dart'; import 'package:gecko/screens/onBoarding/4.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepFor extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 3; final int progress = 3;
OnboardingStepFor({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,7 +26,7 @@ class OnboardingStepFor extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Si un jour vous changez de téléphone, il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.", "Si un jour vous changez de téléphone, il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.",
textKey: Key('step3'), textKey: const Key('step3'),
), ),
SizedBox(height: isTall ? 15 : 0), SizedBox(height: isTall ? 15 : 0),
// Row(children: <Widget>[ // Row(children: <Widget>[
@ -41,7 +45,7 @@ class OnboardingStepFor extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep4'), key: const Key('goStep4'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -54,10 +58,10 @@ class OnboardingStepFor extends StatelessWidget {
page: OnboardingStepFive(), isFast: true), page: OnboardingStepFive(), isFast: true),
); );
}, },
child: Text("J'ai compris", child: const Text("J'ai compris",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/5.dart'; import 'package:gecko/screens/onBoarding/5.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepFive extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 4; final int progress = 4;
OnboardingStepFive({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,7 +26,7 @@ class OnboardingStepFive extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Par contre, attention :\n\nDans une blockchain, il ny a pas de procédure de récupération de trousseau.\n\nSi vous perdez votre phrase de restauration, je ne pourrai pas vous la communiquer, et vous ne pourrez donc plus jamais accéder à votre compte.", "Par contre, attention :\n\nDans une blockchain, il ny a pas de procédure de récupération de trousseau.\n\nSi vous perdez votre phrase de restauration, je ne pourrai pas vous la communiquer, et vous ne pourrez donc plus jamais accéder à votre compte.",
textKey: Key('step4'), textKey: const Key('step4'),
), ),
SizedBox(height: isTall ? 30 : 10), SizedBox(height: isTall ? 30 : 10),
Image.asset( Image.asset(
@ -36,7 +40,7 @@ class OnboardingStepFive extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep5'), key: const Key('goStep5'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,10 +53,10 @@ class OnboardingStepFive extends StatelessWidget {
page: OnboardingStepSeven(), isFast: true), page: OnboardingStepSeven(), isFast: true),
); );
}, },
child: Text("J'ai compris", child: const Text("J'ai compris",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/6.dart'; import 'package:gecko/screens/onBoarding/6.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepSeven extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 5; final int progress = 5;
OnboardingStepSeven({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,15 +26,15 @@ class OnboardingStepSeven extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich( common.bubbleSpeakRich(
<TextSpan>[ <TextSpan>[
TextSpan(text: "Munissez-vous d'"), const TextSpan(text: "Munissez-vous d'"),
TextSpan( const TextSpan(
text: 'un papier et dun crayon\n', text: 'un papier et dun crayon\n',
style: TextStyle(fontWeight: FontWeight.bold)), style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan( const TextSpan(
text: text:
"afin de pouvoir noter votre phrase de restauration."), "afin de pouvoir noter votre phrase de restauration."),
], ],
textKey: Key('step5'), textKey: const Key('step5'),
), ),
Expanded( Expanded(
child: Align( child: Align(
@ -53,7 +57,7 @@ class OnboardingStepSeven extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep6'), key: const Key('goStep6'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -66,10 +70,10 @@ class OnboardingStepSeven extends StatelessWidget {
page: OnboardingStepEight(), isFast: true), page: OnboardingStepEight(), isFast: true),
); );
}, },
child: Text("J'ai de quoi noter", child: const Text("J'ai de quoi noter",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
), ),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -1,8 +1,10 @@
// ignore_for_file: file_names
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/7.dart'; import 'package:gecko/screens/onBoarding/7.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -10,6 +12,8 @@ class OnboardingStepEight extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 6; final int progress = 6;
OnboardingStepEight({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -23,7 +27,7 @@ class OnboardingStepEight extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.", "Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.",
textKey: Key('step6'), textKey: const Key('step6'),
), ),
SizedBox(height: isTall ? 61 : 31), SizedBox(height: isTall ? 61 : 31),
// SizedBox(height: 30), // SizedBox(height: 30),
@ -36,7 +40,7 @@ class OnboardingStepEight extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep7'), key: const Key('goStep7'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -49,10 +53,10 @@ class OnboardingStepEight extends StatelessWidget {
page: OnboardingStepNine(), isFast: false), page: OnboardingStepNine(), isFast: false),
); );
}, },
child: Text("Afficher ma phrase", child: const Text("Afficher ma phrase",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }
@ -60,16 +64,16 @@ class OnboardingStepEight extends StatelessWidget {
Widget sentanceArray(BuildContext context) { Widget sentanceArray(BuildContext context) {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.black), border: Border.all(color: Colors.black),
color: Colors.grey[300], color: Colors.grey[300],
borderRadius: BorderRadius.all( borderRadius: const BorderRadius.all(
const Radius.circular(10), Radius.circular(10),
)), )),
// color: Colors.grey[300], // color: Colors.grey[300],
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -81,14 +85,14 @@ Widget sentanceArray(BuildContext context) {
arrayCell("3:curseur"), arrayCell("3:curseur"),
arrayCell("4:relatif"), arrayCell("4:relatif"),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell("5:embellir"), arrayCell("5:embellir"),
arrayCell("6:cultiver"), arrayCell("6:cultiver"),
arrayCell("7:bureau"), arrayCell("7:bureau"),
arrayCell("8:ossature"), arrayCell("8:ossature"),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell("9:labial"), arrayCell("9:labial"),
arrayCell("10:science"), arrayCell("10:science"),
@ -99,20 +103,20 @@ Widget sentanceArray(BuildContext context) {
} }
Widget arrayCell(dataWord) { Widget arrayCell(dataWord) {
return Container( return SizedBox(
width: 102, width: 102,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
ImageFiltered( ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 1, sigmaY: 1), imageFilter: ImageFilter.blur(sigmaX: 1, sigmaY: 1),
child: Text(dataWord.split(':')[0], child: Text(dataWord.split(':')[0],
style: TextStyle(fontSize: 14, color: Colors.black)), style: const TextStyle(fontSize: 14, color: Colors.black)),
), ),
SizedBox(height: 2), const SizedBox(height: 2),
ImageFiltered( ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 4, sigmaY: 4), imageFilter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
child: Text(dataWord.split(':')[1], child: Text(dataWord.split(':')[1],
style: TextStyle(fontSize: 20, color: Colors.black)), style: const TextStyle(fontSize: 20, color: Colors.black)),
) )
], ],
)); ));

View File

@ -1,8 +1,10 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.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/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/8.dart'; import 'package:gecko/screens/onBoarding/8.dart';
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -12,6 +14,8 @@ class OnboardingStepNine extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 6; final int progress = 6;
OnboardingStepNine({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -29,7 +33,7 @@ class OnboardingStepNine extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"C'est le moment de noter votre phrase !", "C'est le moment de noter votre phrase !",
textKey: Key('step7'), textKey: const Key('step7'),
long: 60, long: 60,
), ),
SizedBox(height: isTall ? 100 : 70), SizedBox(height: isTall ? 100 : 70),
@ -56,24 +60,24 @@ class OnboardingStepNine extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('generateMnemonic'), key: const Key('generateMnemonic'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffFFD58D), primary: const Color(0xffFFD58D),
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () { onPressed: () {
_generateWalletProvider.reloadBuild(); _generateWalletProvider.reloadBuild();
}, },
child: Text("Choisir une autre phrase", child: const Text("Choisir une autre phrase",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 25), const SizedBox(height: 25),
SizedBox( SizedBox(
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep8'), key: const Key('goStep8'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -97,10 +101,10 @@ class OnboardingStepNine extends StatelessWidget {
isFast: true), isFast: true),
); );
}, },
child: Text("J'ai noté ma phrase", child: const Text("J'ai noté ma phrase",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
), ),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }
@ -112,7 +116,7 @@ Widget sentanceArray(BuildContext context) {
return FutureBuilder( return FutureBuilder(
future: _generateWalletProvider.generateWordList(), future: _generateWalletProvider.generateWordList(),
initialData: [ initialData: const [
'1:...', '1:...',
'2:...', '2:...',
'3:...', '3:...',
@ -129,16 +133,16 @@ Widget sentanceArray(BuildContext context) {
builder: (context, formatedArray) { builder: (context, formatedArray) {
// print(formatedArray.data); // print(formatedArray.data);
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.black), border: Border.all(color: Colors.black),
color: Colors.grey[300], color: Colors.grey[300],
borderRadius: BorderRadius.all( borderRadius: const BorderRadius.all(
const Radius.circular(10), Radius.circular(10),
)), )),
// color: Colors.grey[300], // color: Colors.grey[300],
padding: EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -150,14 +154,14 @@ Widget sentanceArray(BuildContext context) {
arrayCell(formatedArray.data[2]), arrayCell(formatedArray.data[2]),
arrayCell(formatedArray.data[3]), arrayCell(formatedArray.data[3]),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell(formatedArray.data[4]), arrayCell(formatedArray.data[4]),
arrayCell(formatedArray.data[5]), arrayCell(formatedArray.data[5]),
arrayCell(formatedArray.data[6]), arrayCell(formatedArray.data[6]),
arrayCell(formatedArray.data[7]), arrayCell(formatedArray.data[7]),
]), ]),
SizedBox(height: 15), const SizedBox(height: 15),
Row(children: <Widget>[ Row(children: <Widget>[
arrayCell(formatedArray.data[8]), arrayCell(formatedArray.data[8]),
arrayCell(formatedArray.data[9]), arrayCell(formatedArray.data[9]),
@ -169,20 +173,20 @@ Widget sentanceArray(BuildContext context) {
} }
Widget arrayCell(dataWord) { Widget arrayCell(dataWord) {
return Container( return SizedBox(
width: 102, width: 102,
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Text(dataWord.split(':')[0], style: TextStyle(fontSize: 14)), Text(dataWord.split(':')[0], style: const TextStyle(fontSize: 14)),
SizedBox(height: 2), const SizedBox(height: 2),
Text(dataWord.split(':')[1], Text(dataWord.split(':')[1],
key: Key('word${dataWord.split(':')[0]}'), key: Key('word${dataWord.split(':')[0]}'),
style: TextStyle(fontSize: 19, color: Colors.black)), style: const TextStyle(fontSize: 19, color: Colors.black)),
])); ]));
} }
// ignore: must_be_immutable // ignore: must_be_immutable
class PrintWallet extends StatelessWidget { class PrintWallet extends StatelessWidget {
PrintWallet(this.sentence); const PrintWallet(this.sentence, {Key key}) : super(key: key);
final String sentence; final String sentence;
@ -192,7 +196,7 @@ class PrintWallet extends StatelessWidget {
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
appBar: AppBar(title: Text('Imprimer ce trousseau')), appBar: AppBar(title: const Text('Imprimer ce trousseau')),
body: PdfPreview( body: PdfPreview(
build: (format) => _generateWalletProvider.printWallet(sentence), build: (format) => _generateWalletProvider.printWallet(sentence),
), ),

View File

@ -1,10 +1,12 @@
// ignore_for_file: file_names
import 'dart:ui'; import 'dart:ui';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.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/generateWallets.dart'; import 'package:gecko/models/generate_wallets.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/9.dart'; import 'package:gecko/screens/onBoarding/9.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -21,7 +23,7 @@ class OnboardingStepTen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
TextEditingController wordController = TextEditingController(); TextEditingController wordController = TextEditingController();
TextEditingController _mnemonicController = TextEditingController(); final TextEditingController _mnemonicController = TextEditingController();
final int progress = 7; final int progress = 7;
@ -31,7 +33,7 @@ class OnboardingStepTen extends StatelessWidget {
GenerateWalletsProvider _generateWalletProvider = GenerateWalletsProvider _generateWalletProvider =
Provider.of<GenerateWalletsProvider>(context); Provider.of<GenerateWalletsProvider>(context);
CommonElements common = CommonElements(); CommonElements common = CommonElements();
this._mnemonicController.text = generatedMnemonic; _mnemonicController.text = generatedMnemonic;
return WillPopScope( return WillPopScope(
onWillPop: () { onWillPop: () {
@ -60,11 +62,11 @@ class OnboardingStepTen extends StatelessWidget {
text: " de votre phrase de restauration :", text: " de votre phrase de restauration :",
style: TextStyle(fontSize: 16 * ratio)), style: TextStyle(fontSize: 16 * ratio)),
], ],
textKey: Key('step8'), textKey: const Key('step8'),
), ),
SizedBox(height: isTall ? 70 : 10), SizedBox(height: isTall ? 70 : 10),
Text('${_generateWalletProvider.nbrWord + 1}', Text('${_generateWalletProvider.nbrWord + 1}',
key: Key('askedWord'), key: const Key('askedWord'),
style: TextStyle( style: TextStyle(
fontSize: isTall ? 17 : 10, fontSize: isTall ? 17 : 10,
color: orangeC, color: orangeC,
@ -79,10 +81,10 @@ class OnboardingStepTen extends StatelessWidget {
)), )),
width: 430, width: 430,
child: TextFormField( child: TextFormField(
key: Key('inputWord'), key: const Key('inputWord'),
autofocus: true, autofocus: true,
enabled: !_generateWalletProvider.isAskedWordValid, enabled: !_generateWalletProvider.isAskedWordValid,
controller: this.wordController, controller: wordController,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
onChanged: (value) { onChanged: (value) {
_generateWalletProvider.checkAskedWord( _generateWalletProvider.checkAskedWord(
@ -100,7 +102,7 @@ class OnboardingStepTen extends StatelessWidget {
: "${_generateWalletProvider.nbrWordAlpha} mot de votre phrase de restauration", : "${_generateWalletProvider.nbrWordAlpha} mot de votre phrase de restauration",
fillColor: Colors.grey[300], fillColor: Colors.grey[300],
filled: true, filled: true,
contentPadding: EdgeInsets.all(12), contentPadding: const EdgeInsets.all(12),
), ),
style: TextStyle( style: TextStyle(
fontSize: 40.0, fontSize: 40.0,
@ -115,7 +117,7 @@ class OnboardingStepTen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep9'), key: const Key('goStep9'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -129,10 +131,10 @@ class OnboardingStepTen extends StatelessWidget {
isFast: true), isFast: true),
); );
}, },
child: Text("Continuer", child: const Text("Continuer",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
)))), )))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
))); )));
} }

View File

@ -1,7 +1,9 @@
// ignore_for_file: file_names
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/commonElements.dart'; import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/10.dart'; import 'package:gecko/screens/onBoarding/10.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -9,6 +11,8 @@ class OnboardingStepEleven extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
final int progress = 8; final int progress = 8;
OnboardingStepEleven({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
@ -22,15 +26,16 @@ class OnboardingStepEleven extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich( common.bubbleSpeakRich(
<TextSpan>[ <TextSpan>[
TextSpan(text: "Super !\n\nJe vais maintenant créer votre "), const TextSpan(
TextSpan( text: "Super !\n\nJe vais maintenant créer votre "),
const TextSpan(
text: 'code secret.', text: 'code secret.',
style: TextStyle(fontWeight: FontWeight.bold)), style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan( const TextSpan(
text: text:
" \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole."), " \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole."),
], ],
textKey: Key('step9'), textKey: const Key('step9'),
), ),
SizedBox(height: isTall ? 50 : 10), SizedBox(height: isTall ? 50 : 10),
Image.asset( Image.asset(
@ -44,7 +49,7 @@ class OnboardingStepEleven extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep10'), key: const Key('goStep10'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: orangeC, primary: orangeC,
@ -57,10 +62,10 @@ class OnboardingStepEleven extends StatelessWidget {
page: OnboardingStepTwelve(), isFast: true), page: OnboardingStepTwelve(), isFast: true),
); );
}, },
child: Text("J'ai compris", child: const Text("J'ai compris",
style: TextStyle(fontSize: 20))), style: TextStyle(fontSize: 20))),
))), ))),
SizedBox(height: 80), const SizedBox(height: 80),
]), ]),
)); ));
} }

View File

@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:dubp/dubp.dart'; import 'package:dubp/dubp.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/models/home.dart'; import 'package:gecko/models/home.dart';
import 'package:gecko/models/myWallets.dart'; import 'package:gecko/models/my_wallets.dart';
import 'package:gecko/screens/myWallets/generateWallets.dart'; import 'package:gecko/screens/myWallets/generate_wallets.dart';
import 'dart:io'; import 'dart:io';
import 'package:gecko/screens/myWallets/importWallet.dart'; import 'package:gecko/screens/myWallets/import_wallet.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -22,7 +22,9 @@ class SettingsScreen extends StatelessWidget {
var pinColor = Colors.grey[300]; var pinColor = Colors.grey[300];
Directory appPath; Directory appPath;
MyWalletsProvider _myWallets = MyWalletsProvider(); final MyWalletsProvider _myWallets = MyWalletsProvider();
SettingsScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,12 +34,12 @@ class SettingsScreen extends StatelessWidget {
// getAppDirectory(); // getAppDirectory();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Paramètres'), child: Text('Paramètres'),
)), )),
body: Column(children: <Widget>[ body: Column(children: <Widget>[
SizedBox(height: 40), const SizedBox(height: 40),
SizedBox( SizedBox(
height: 70, height: 70,
width: 500, width: 500,
@ -50,19 +52,19 @@ class SettingsScreen extends StatelessWidget {
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return ImportWalletScreen(); return const ImportWalletScreen();
}), }),
).then((value) => { ).then((value) => {
if (value == true) {Navigator.pop(context)} if (value == true) {Navigator.pop(context)}
}), }),
child: Text("Importer un portefeuille Cesium", child: const Text("Importer un portefeuille Cesium",
style: TextStyle(fontSize: 16)))), style: TextStyle(fontSize: 16)))),
SizedBox(height: 30), const SizedBox(height: 30),
SizedBox( SizedBox(
height: 70, height: 70,
width: 500, width: 500,
child: ElevatedButton( child: ElevatedButton(
key: Key('generateKeychain'), key: const Key('generateKeychain'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: yellowC, // background primary: yellowC, // background
@ -76,7 +78,7 @@ class SettingsScreen extends StatelessWidget {
).then((value) => { ).then((value) => {
if (value == true) {Navigator.pop(context)} if (value == true) {Navigator.pop(context)}
}), }),
child: Text("Générer un nouveau trousseau", child: const Text("Générer un nouveau trousseau",
style: TextStyle(fontSize: 16)))), style: TextStyle(fontSize: 16)))),
Expanded( Expanded(
child: Align( child: Align(
@ -85,7 +87,7 @@ class SettingsScreen extends StatelessWidget {
height: 100, height: 100,
width: 500, width: 500,
child: ElevatedButton( child: ElevatedButton(
key: Key('deleteAllWallets'), key: const Key('deleteAllWallets'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Colors.redAccent, // background primary: Colors.redAccent, // background
@ -97,9 +99,9 @@ class SettingsScreen extends StatelessWidget {
.deleteAllWallet(context) .deleteAllWallet(context)
.then((v) => _homeProvider.rebuildWidget()) .then((v) => _homeProvider.rebuildWidget())
}, },
child: Text("EFFACER TOUS MES PORTEFEUILLES", child: const Text("EFFACER TOUS MES PORTEFEUILLES",
style: TextStyle(fontSize: 20)))))), style: TextStyle(fontSize: 20)))))),
SizedBox(height: 50), const SizedBox(height: 50),
])); ]));
} }
} }

View File

@ -9,17 +9,19 @@ import 'package:flutter/material.dart';
class TemplateScreen extends StatelessWidget { class TemplateScreen extends StatelessWidget {
TextEditingController tplController = TextEditingController(); TextEditingController tplController = TextEditingController();
TemplateScreen({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context); // HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: SizedBox( title: const SizedBox(
height: 22, height: 22,
child: Text('Template screen'), child: Text('Template screen'),
)), )),
floatingActionButton: Container( floatingActionButton: SizedBox(
height: 80.0, height: 80.0,
width: 80.0, width: 80.0,
child: FittedBox( child: FittedBox(
@ -28,10 +30,10 @@ class TemplateScreen extends StatelessWidget {
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return HomeScreen(); return const HomeScreen();
}), }),
), ),
child: Container( child: SizedBox(
height: 40.0, height: 40.0,
width: 40.0, width: 40.0,
child: Icon(Icons.home, color: Colors.grey[850]), child: Icon(Icons.home, color: Colors.grey[850]),
@ -41,20 +43,20 @@ class TemplateScreen extends StatelessWidget {
))), ))),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
SizedBox(height: 20), const SizedBox(height: 20),
TextField( TextField(
enabled: true, enabled: true,
controller: tplController, controller: tplController,
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: InputDecoration( decoration: const InputDecoration(
contentPadding: EdgeInsets.all(15.0), contentPadding: EdgeInsets.all(15.0),
), ),
style: TextStyle( style: const TextStyle(
fontSize: 22.0, fontSize: 22.0,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400)), fontWeight: FontWeight.w400)),
SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: yellowC, // background primary: yellowC, // background
@ -64,12 +66,13 @@ class TemplateScreen extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return HomeScreen(); return const HomeScreen();
}), }),
); );
}, },
child: Text('Retour Accueil', style: TextStyle(fontSize: 20))), child: const Text('Retour Accueil',
SizedBox(height: 20), style: TextStyle(fontSize: 20))),
const SizedBox(height: 20),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.popUntil( Navigator.popUntil(
@ -77,7 +80,7 @@ class TemplateScreen extends StatelessWidget {
ModalRoute.withName('/'), ModalRoute.withName('/'),
); );
}, },
child: Icon(Icons.home)) child: const Icon(Icons.home))
]), ]),
)); ));
} }

7
macos/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/
# Xcode-related
**/dgph
**/xcuserdata/

View File

@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"

View File

@ -0,0 +1,24 @@
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import connectivity_plus_macos
import package_info
import package_info_plus_macos
import path_provider_macos
import printing
import sentry_flutter
import shared_preferences_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}

View File

@ -0,0 +1,572 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objects = {
/* Begin PBXAggregateTarget section */
33CC111A2044C6BA0003C045 /* Flutter Assemble */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
buildPhases = (
33CC111E2044C6BF0003C045 /* ShellScript */,
);
dependencies = (
);
name = "Flutter Assemble";
productName = FLX;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 33CC111A2044C6BA0003C045;
remoteInfo = FLX;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
33CC110E2044A8840003C045 /* Bundle Framework */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* gecko.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "gecko.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; };
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; };
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
33CC10EA2044A3C60003C045 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
33BA886A226E78AF003329D5 /* Configs */ = {
isa = PBXGroup;
children = (
33E5194F232828860026EE4D /* AppInfo.xcconfig */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
);
path = Configs;
sourceTree = "<group>";
};
33CC10E42044A3C60003C045 = {
isa = PBXGroup;
children = (
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
);
sourceTree = "<group>";
};
33CC10EE2044A3C60003C045 /* Products */ = {
isa = PBXGroup;
children = (
33CC10ED2044A3C60003C045 /* gecko.app */,
);
name = Products;
sourceTree = "<group>";
};
33CC11242044D66E0003C045 /* Resources */ = {
isa = PBXGroup;
children = (
33CC10F22044A3C60003C045 /* Assets.xcassets */,
33CC10F42044A3C60003C045 /* MainMenu.xib */,
33CC10F72044A3C60003C045 /* Info.plist */,
);
name = Resources;
path = ..;
sourceTree = "<group>";
};
33CEB47122A05771004F2AC0 /* Flutter */ = {
isa = PBXGroup;
children = (
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
);
path = Flutter;
sourceTree = "<group>";
};
33FAB671232836740065AC1E /* Runner */ = {
isa = PBXGroup;
children = (
33CC10F02044A3C60003C045 /* AppDelegate.swift */,
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
33E51913231747F40026EE4D /* DebugProfile.entitlements */,
33E51914231749380026EE4D /* Release.entitlements */,
33CC11242044D66E0003C045 /* Resources */,
33BA886A226E78AF003329D5 /* Configs */,
);
path = Runner;
sourceTree = "<group>";
};
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
33CC10EC2044A3C60003C045 /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
33CC10E92044A3C60003C045 /* Sources */,
33CC10EA2044A3C60003C045 /* Frameworks */,
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
);
buildRules = (
);
dependencies = (
33CC11202044C79F0003C045 /* PBXTargetDependency */,
);
name = Runner;
productName = Runner;
productReference = 33CC10ED2044A3C60003C045 /* gecko.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
33CC10E52044A3C60003C045 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 1;
};
};
};
33CC111A2044C6BA0003C045 = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Manual;
};
};
};
buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 33CC10E42044A3C60003C045;
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
33CC10EC2044A3C60003C045 /* Runner */,
33CC111A2044C6BA0003C045 /* Flutter Assemble */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
33CC10EB2044A3C60003C045 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
};
33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
Flutter/ephemeral/FlutterInputs.xcfilelist,
);
inputPaths = (
Flutter/ephemeral/tripwire,
);
outputFileListPaths = (
Flutter/ephemeral/FlutterOutputs.xcfilelist,
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
33CC10E92044A3C60003C045 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
33CC10F52044A3C60003C045 /* Base */,
);
name = MainMenu.xib;
path = Runner;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
338D0CE9231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Profile;
};
338D0CEA231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Profile;
};
338D0CEB231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Profile;
};
33CC10F92044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
33CC10FA2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
33CC10FC2044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
33CC10FD2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Release;
};
33CC111C2044C6BA0003C045 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
33CC111D2044C6BA0003C045 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10F92044A3C60003C045 /* Debug */,
33CC10FA2044A3C60003C045 /* Release */,
338D0CE9231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10FC2044A3C60003C045 /* Debug */,
33CC10FD2044A3C60003C045 /* Release */,
338D0CEA231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC111C2044C6BA0003C045 /* Debug */,
33CC111D2044C6BA0003C045 /* Release */,
338D0CEB231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "gecko.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,9 @@
import Cocoa
import FlutterMacOS
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}

View File

@ -0,0 +1,68 @@
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_64.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_1024.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,339 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Runner" customModuleProvider="target">
<connections>
<outlet property="applicationMenu" destination="uQy-DD-JDr" id="XBo-yE-nKs"/>
<outlet property="mainFlutterWindow" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="APP_NAME" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="APP_NAME" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About APP_NAME" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide APP_NAME" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit APP_NAME" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
<point key="canvasLocation" x="142" y="-258"/>
</menu>
<window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="335" y="390" width="800" height="600"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="800" height="600"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</window>
</objects>
</document>

View File

@ -0,0 +1,14 @@
// Application-level settings for the Runner target.
//
// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
// future. If not, the values below would default to using the project name when this becomes a
// 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = gecko
// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.gecko
// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved.

View File

@ -0,0 +1,2 @@
#include "../../Flutter/Flutter-Debug.xcconfig"
#include "Warnings.xcconfig"

View File

@ -0,0 +1,2 @@
#include "../../Flutter/Flutter-Release.xcconfig"
#include "Warnings.xcconfig"

View File

@ -0,0 +1,13 @@
WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
CLANG_WARN_PRAGMA_PACK = YES
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_COMMA = YES
GCC_WARN_STRICT_SELECTOR_MATCH = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
GCC_WARN_SHADOW = YES
CLANG_WARN_UNREACHABLE_CODE = YES

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>

32
macos/Runner/Info.plist Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>$(PRODUCT_COPYRIGHT)</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,15 @@
import Cocoa
import FlutterMacOS
class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController.init()
let windowFrame = self.frame
self.contentViewController = flutterViewController
self.setFrame(windowFrame, display: true)
RegisterGeneratedPlugins(registry: flutterViewController)
super.awakeFromNib()
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>

View File

@ -326,6 +326,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.2" version: "0.9.2"
flutter_lints:
dependency: "direct main"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_logs: flutter_logs:
dependency: "direct main" dependency: "direct main"
description: description:
@ -577,6 +584,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.3.0" version: "4.3.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
logger: logger:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -55,6 +55,7 @@ dependencies:
xml: ^5.3.0 xml: ^5.3.0
assorted_layout_widgets: ^5.2.1 assorted_layout_widgets: ^5.2.1
carousel_slider: ^4.0.0 carousel_slider: ^4.0.0
flutter_lints: ^1.0.4
flutter_icons: flutter_icons:
android: "ic_launcher" android: "ic_launcher"

View File

@ -2,6 +2,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:flutter_driver/flutter_driver.dart'; import 'package:flutter_driver/flutter_driver.dart';
import 'package:gecko/globals.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
// import 'package:flutter/services.dart'; // import 'package:flutter/services.dart';
@ -108,7 +109,7 @@ void main() {
await sleep(300); await sleep(300);
await tapOn('generateKeychain'); await tapOn('generateKeychain');
while (await getText('generatedPin') == '') { while (await getText('generatedPin') == '') {
print('Waiting for pin code generation...'); log.i('Waiting for pin code generation...');
await sleep(100); await sleep(100);
} }
pinCode = await getText('generatedPin'); pinCode = await getText('generatedPin');
@ -125,13 +126,10 @@ void main() {
// *** Begin of tests *** // // *** Begin of tests *** //
test('OnBoarding - Open wallets management', ( test('OnBoarding - Open wallets management', (
{timeout: Timeout.none}) async { {timeout = Timeout.none}) async {
// await driver.runUnsynchronized(() async { // Needed if we want to manage async drivers // await driver.runUnsynchronized(() async { // Needed if we want to manage async drivers
await driver.tap(manageWalletsFinder); await driver.tap(manageWalletsFinder);
print(
'####################################################################');
// If a wallet exist, go to delete theme all // If a wallet exist, go to delete theme all
if (!await isPresent(find.byValueKey('goStep1'))) { if (!await isPresent(find.byValueKey('goStep1'))) {
await goBack(); await goBack();
@ -154,7 +152,7 @@ void main() {
}); });
test('OnBoarding - Go to create restore sentance', ( test('OnBoarding - Go to create restore sentance', (
{timeout: Timeout.none}) async { {timeout = Timeout.none}) async {
await tapOn('goStep1'); await tapOn('goStep1');
await tapOn('goStep2'); await tapOn('goStep2');
await tapOn('goStep3'); await tapOn('goStep3');
@ -170,11 +168,11 @@ void main() {
}); });
test('OnBoarding - Generate sentance and confirme it', ( test('OnBoarding - Generate sentance and confirme it', (
{timeout: Timeout.none}) async { {timeout = Timeout.none}) async {
await tapOn('goStep7'); await tapOn('goStep7');
while (await getText('word1') == '...') { while (await getText('word1') == '...') {
print('Waiting for Mnemonic generation...'); log.i('Waiting for Mnemonic generation...');
await sleep(100); await sleep(100);
} }
@ -220,7 +218,7 @@ void main() {
await selectWord(); await selectWord();
}); });
test('OnBoarding - Generate secret code and confirm it', ( test('OnBoarding - Generate secret code and confirm it', (
{timeout: Timeout.none}) async { {timeout = Timeout.none}) async {
expect(await getText('step9'), expect(await getText('step9'),
"Super !\n\nJe vais maintenant créer votre code secret. \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole."); "Super !\n\nJe vais maintenant créer votre code secret. \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole.");
@ -228,12 +226,14 @@ void main() {
await tapOn('goStep11'); await tapOn('goStep11');
while (await getText('generatedPin') == '') { while (await getText('generatedPin') == '') {
print('Waiting for pin code generation...'); log.i('Waiting for pin code generation...');
await sleep(100); await sleep(100);
} }
// Change secret code 4 times // Change secret code 4 times
for (int i = 0; i < 4; i++) await tapOn('changeSecretCode'); for (int i = 0; i < 4; i++) {
await tapOn('changeSecretCode');
}
await sleep(500); await sleep(500);
pinCode = await getText('generatedPin'); pinCode = await getText('generatedPin');
@ -255,7 +255,7 @@ void main() {
}); });
test('My wallets - Rename first derivation', ( test('My wallets - Rename first derivation', (
{timeout: const Duration(seconds: 2)}) async { {timeout = const Duration(seconds: 2)}) async {
await tapOn('goWalletHome'); await tapOn('goWalletHome');
expect(await getText('myWallets'), "Mes portefeuilles"); expect(await getText('myWallets'), "Mes portefeuilles");
@ -278,7 +278,7 @@ void main() {
}); });
test('My wallets - Create a derivations, open thems, tap all buttons', ( test('My wallets - Create a derivations, open thems, tap all buttons', (
{timeout: const Duration(seconds: 2)}) async { {timeout = const Duration(seconds: 2)}) async {
await driver.waitFor(find.text('Renommage wallet 1'), timeout: timeout); await driver.waitFor(find.text('Renommage wallet 1'), timeout: timeout);
// Add a second derivation // Add a second derivation
await createDerivation('Derivation 2'); await createDerivation('Derivation 2');
@ -321,7 +321,7 @@ void main() {
}); });
test('My wallets - Extra tests', ( test('My wallets - Extra tests', (
{timeout: const Duration(seconds: 2)}) async { {timeout = const Duration(seconds: 2)}) async {
// Add derivation 5,6 and 7 // Add derivation 5,6 and 7
await driver.waitFor(find.text('Derivation 4'), timeout: timeout); await driver.waitFor(find.text('Derivation 4'), timeout: timeout);
await createDerivation('Derivation 5'); await createDerivation('Derivation 5');
@ -404,7 +404,7 @@ void main() {
}); });
test('Search - Search Pi profile, navigate in history transactions', ( test('Search - Search Pi profile, navigate in history transactions', (
{timeout: const Duration(seconds: 2)}) async { {timeout = const Duration(seconds: 2)}) async {
await driver.waitFor(find.text('Derivation 20'), timeout: timeout); await driver.waitFor(find.text('Derivation 20'), timeout: timeout);
await goBack(); await goBack();
await goBack(); await goBack();
@ -436,7 +436,7 @@ void main() {
}, timeout: Timeout(Duration(minutes: globalTimeout))); }, timeout: Timeout(Duration(minutes: globalTimeout)));
test('Wallet generation - Fast wallets generations', ( test('Wallet generation - Fast wallets generations', (
{timeout: const Duration(seconds: 2)}) async { {timeout = const Duration(seconds: 2)}) async {
await driver.waitFor(find.text('Commentaire:'), timeout: timeout); await driver.waitFor(find.text('Commentaire:'), timeout: timeout);
await goBack(); await goBack();
await goBack(); await goBack();

17
windows/.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
flutter/ephemeral/
# Visual Studio user-specific files.
*.suo
*.user
*.userosscache
*.sln.docstates
# Visual Studio build-related files.
x64/
x86/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

95
windows/CMakeLists.txt Normal file
View File

@ -0,0 +1,95 @@
cmake_minimum_required(VERSION 3.15)
project(gecko LANGUAGES CXX)
set(BINARY_NAME "gecko")
cmake_policy(SET CMP0063 NEW)
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
# Configure build options.
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(IS_MULTICONFIG)
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
CACHE STRING "" FORCE)
else()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
endif()
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
# Use Unicode for all projects.
add_definitions(-DUNICODE -D_UNICODE)
# Compilation settings that should be applied to most targets.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
endfunction()
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
# Flutter library and tool build rules.
add_subdirectory(${FLUTTER_MANAGED_DIR})
# Application build
add_subdirectory("runner")
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
# === Installation ===
# Support files are copied into place next to the executable, so that it can
# run in place. This is done instead of making a separate bundle (as on Linux)
# so that building and running from within Visual Studio will work.
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
# Make the "install" step default, as it's required to run.
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
if(PLUGIN_BUNDLED_LIBRARIES)
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
# Install the AOT library on non-Debug builds only.
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
CONFIGURATIONS Profile;Release
COMPONENT Runtime)

View File

@ -0,0 +1,103 @@
cmake_minimum_required(VERSION 3.15)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"flutter_export.h"
"flutter_windows.h"
"flutter_messenger.h"
"flutter_plugin_registrar.h"
"flutter_texture_registrar.h"
)
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
add_dependencies(flutter flutter_assemble)
# === Wrapper ===
list(APPEND CPP_WRAPPER_SOURCES_CORE
"core_implementations.cc"
"standard_codec.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
"plugin_registrar.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_APP
"flutter_engine.cc"
"flutter_view_controller.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
# Wrapper sources needed for a plugin.
add_library(flutter_wrapper_plugin STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
)
apply_standard_settings(flutter_wrapper_plugin)
set_target_properties(flutter_wrapper_plugin PROPERTIES
POSITION_INDEPENDENT_CODE ON)
set_target_properties(flutter_wrapper_plugin PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
target_include_directories(flutter_wrapper_plugin PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_plugin flutter_assemble)
# Wrapper sources needed for the runner.
add_library(flutter_wrapper_app STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_APP}
)
apply_standard_settings(flutter_wrapper_app)
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
target_include_directories(flutter_wrapper_app PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_app flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
${PHONY_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
)

View File

@ -0,0 +1,20 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <connectivity_plus_windows/connectivity_plus_windows_plugin.h>
#include <printing/printing_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
PrintingPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PrintingPlugin"));
SentryFlutterPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
}

View File

@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter/plugin_registry.h>
// Registers Flutter plugins.
void RegisterPlugins(flutter::PluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_

View File

@ -0,0 +1,18 @@
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus_windows
printing
sentry_flutter
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.15)
project(runner LANGUAGES CXX)
add_executable(${BINARY_NAME} WIN32
"flutter_window.cpp"
"main.cpp"
"utils.cpp"
"win32_window.cpp"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
"Runner.rc"
"runner.exe.manifest"
)
apply_standard_settings(${BINARY_NAME})
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
add_dependencies(${BINARY_NAME} flutter_assemble)

121
windows/runner/Runner.rc Normal file
View File

@ -0,0 +1,121 @@
// Microsoft Visual C++ generated resource script.
//
#pragma code_page(65001)
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP_ICON ICON "resources\\app_icon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#else
#define VERSION_AS_NUMBER 1,0,0
#endif
#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#else
#define VERSION_AS_STRING "1.0.0"
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_AS_NUMBER
PRODUCTVERSION VERSION_AS_NUMBER
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "com.example" "\0"
VALUE "FileDescription", "A new Flutter project." "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "gecko" "\0"
VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0"
VALUE "OriginalFilename", "gecko.exe" "\0"
VALUE "ProductName", "gecko" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,61 @@
#include "flutter_window.h"
#include <optional>
#include "flutter/generated_plugin_registrant.h"
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
: project_(project) {}
FlutterWindow::~FlutterWindow() {}
bool FlutterWindow::OnCreate() {
if (!Win32Window::OnCreate()) {
return false;
}
RECT frame = GetClientArea();
// The size here must match the window dimensions to avoid unnecessary surface
// creation / destruction in the startup path.
flutter_controller_ = std::make_unique<flutter::FlutterViewController>(
frame.right - frame.left, frame.bottom - frame.top, project_);
// Ensure that basic setup of the controller was successful.
if (!flutter_controller_->engine() || !flutter_controller_->view()) {
return false;
}
RegisterPlugins(flutter_controller_->engine());
SetChildContent(flutter_controller_->view()->GetNativeWindow());
return true;
}
void FlutterWindow::OnDestroy() {
if (flutter_controller_) {
flutter_controller_ = nullptr;
}
Win32Window::OnDestroy();
}
LRESULT
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept {
// Give Flutter, including plugins, an opportunity to handle window messages.
if (flutter_controller_) {
std::optional<LRESULT> result =
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
lparam);
if (result) {
return *result;
}
}
switch (message) {
case WM_FONTCHANGE:
flutter_controller_->engine()->ReloadSystemFonts();
break;
}
return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
}

View File

@ -0,0 +1,33 @@
#ifndef RUNNER_FLUTTER_WINDOW_H_
#define RUNNER_FLUTTER_WINDOW_H_
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <memory>
#include "win32_window.h"
// A window that does nothing but host a Flutter view.
class FlutterWindow : public Win32Window {
public:
// Creates a new FlutterWindow hosting a Flutter view running |project|.
explicit FlutterWindow(const flutter::DartProject& project);
virtual ~FlutterWindow();
protected:
// Win32Window:
bool OnCreate() override;
void OnDestroy() override;
LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
LPARAM const lparam) noexcept override;
private:
// The project to run.
flutter::DartProject project_;
// The Flutter instance hosted by this window.
std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
};
#endif // RUNNER_FLUTTER_WINDOW_H_

43
windows/runner/main.cpp Normal file
View File

@ -0,0 +1,43 @@
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
#include "flutter_window.h"
#include "utils.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
CreateAndAttachConsole();
}
// Initialize COM, so that it is available for use in the library and/or
// plugins.
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
flutter::DartProject project(L"data");
std::vector<std::string> command_line_arguments =
GetCommandLineArguments();
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"gecko", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);
::MSG msg;
while (::GetMessage(&msg, nullptr, 0, 0)) {
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
::CoUninitialize();
return EXIT_SUCCESS;
}

16
windows/runner/resource.h Normal file
View File

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Runner.rc
//
#define IDI_APP_ICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</windowsSettings>
</application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
</assembly>

64
windows/runner/utils.cpp Normal file
View File

@ -0,0 +1,64 @@
#include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
_dup2(_fileno(stdout), 2);
}
std::ios::sync_with_stdio();
FlutterDesktopResyncOutputStreams();
}
}
std::vector<std::string> GetCommandLineArguments() {
// Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
int argc;
wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
if (argv == nullptr) {
return std::vector<std::string>();
}
std::vector<std::string> command_line_arguments;
// Skip the first argument as it's the binary name.
for (int i = 1; i < argc; i++) {
command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
}
::LocalFree(argv);
return command_line_arguments;
}
std::string Utf8FromUtf16(const wchar_t* utf16_string) {
if (utf16_string == nullptr) {
return std::string();
}
int target_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
-1, nullptr, 0, nullptr, nullptr);
if (target_length == 0) {
return std::string();
}
std::string utf8_string;
utf8_string.resize(target_length);
int converted_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
-1, utf8_string.data(),
target_length, nullptr, nullptr);
if (converted_length == 0) {
return std::string();
}
return utf8_string;
}

19
windows/runner/utils.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef RUNNER_UTILS_H_
#define RUNNER_UTILS_H_
#include <string>
#include <vector>
// Creates a console for the process, and redirects stdout and stderr to
// it for both the runner and the Flutter library.
void CreateAndAttachConsole();
// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
// encoded in UTF-8. Returns an empty std::string on failure.
std::string Utf8FromUtf16(const wchar_t* utf16_string);
// Gets the command line arguments passed in as a std::vector<std::string>,
// encoded in UTF-8. Returns an empty std::vector<std::string> on failure.
std::vector<std::string> GetCommandLineArguments();
#endif // RUNNER_UTILS_H_

View File

@ -0,0 +1,245 @@
#include "win32_window.h"
#include <flutter_windows.h>
#include "resource.h"
namespace {
constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
// The number of Win32Window objects that currently exist.
static int g_active_window_count = 0;
using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
// Scale helper to convert logical scaler values to physical using passed in
// scale factor
int Scale(int source, double scale_factor) {
return static_cast<int>(source * scale_factor);
}
// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
// This API is only needed for PerMonitor V1 awareness mode.
void EnableFullDpiSupportIfAvailable(HWND hwnd) {
HMODULE user32_module = LoadLibraryA("User32.dll");
if (!user32_module) {
return;
}
auto enable_non_client_dpi_scaling =
reinterpret_cast<EnableNonClientDpiScaling*>(
GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
if (enable_non_client_dpi_scaling != nullptr) {
enable_non_client_dpi_scaling(hwnd);
FreeLibrary(user32_module);
}
}
} // namespace
// Manages the Win32Window's window class registration.
class WindowClassRegistrar {
public:
~WindowClassRegistrar() = default;
// Returns the singleton registar instance.
static WindowClassRegistrar* GetInstance() {
if (!instance_) {
instance_ = new WindowClassRegistrar();
}
return instance_;
}
// Returns the name of the window class, registering the class if it hasn't
// previously been registered.
const wchar_t* GetWindowClass();
// Unregisters the window class. Should only be called if there are no
// instances of the window.
void UnregisterWindowClass();
private:
WindowClassRegistrar() = default;
static WindowClassRegistrar* instance_;
bool class_registered_ = false;
};
WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
const wchar_t* WindowClassRegistrar::GetWindowClass() {
if (!class_registered_) {
WNDCLASS window_class{};
window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
window_class.lpszClassName = kWindowClassName;
window_class.style = CS_HREDRAW | CS_VREDRAW;
window_class.cbClsExtra = 0;
window_class.cbWndExtra = 0;
window_class.hInstance = GetModuleHandle(nullptr);
window_class.hIcon =
LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
window_class.hbrBackground = 0;
window_class.lpszMenuName = nullptr;
window_class.lpfnWndProc = Win32Window::WndProc;
RegisterClass(&window_class);
class_registered_ = true;
}
return kWindowClassName;
}
void WindowClassRegistrar::UnregisterWindowClass() {
UnregisterClass(kWindowClassName, nullptr);
class_registered_ = false;
}
Win32Window::Win32Window() {
++g_active_window_count;
}
Win32Window::~Win32Window() {
--g_active_window_count;
Destroy();
}
bool Win32Window::CreateAndShow(const std::wstring& title,
const Point& origin,
const Size& size) {
Destroy();
const wchar_t* window_class =
WindowClassRegistrar::GetInstance()->GetWindowClass();
const POINT target_point = {static_cast<LONG>(origin.x),
static_cast<LONG>(origin.y)};
HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
double scale_factor = dpi / 96.0;
HWND window = CreateWindow(
window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
Scale(size.width, scale_factor), Scale(size.height, scale_factor),
nullptr, nullptr, GetModuleHandle(nullptr), this);
if (!window) {
return false;
}
return OnCreate();
}
// static
LRESULT CALLBACK Win32Window::WndProc(HWND const window,
UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept {
if (message == WM_NCCREATE) {
auto window_struct = reinterpret_cast<CREATESTRUCT*>(lparam);
SetWindowLongPtr(window, GWLP_USERDATA,
reinterpret_cast<LONG_PTR>(window_struct->lpCreateParams));
auto that = static_cast<Win32Window*>(window_struct->lpCreateParams);
EnableFullDpiSupportIfAvailable(window);
that->window_handle_ = window;
} else if (Win32Window* that = GetThisFromHandle(window)) {
return that->MessageHandler(window, message, wparam, lparam);
}
return DefWindowProc(window, message, wparam, lparam);
}
LRESULT
Win32Window::MessageHandler(HWND hwnd,
UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept {
switch (message) {
case WM_DESTROY:
window_handle_ = nullptr;
Destroy();
if (quit_on_close_) {
PostQuitMessage(0);
}
return 0;
case WM_DPICHANGED: {
auto newRectSize = reinterpret_cast<RECT*>(lparam);
LONG newWidth = newRectSize->right - newRectSize->left;
LONG newHeight = newRectSize->bottom - newRectSize->top;
SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
return 0;
}
case WM_SIZE: {
RECT rect = GetClientArea();
if (child_content_ != nullptr) {
// Size and position the child window.
MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top, TRUE);
}
return 0;
}
case WM_ACTIVATE:
if (child_content_ != nullptr) {
SetFocus(child_content_);
}
return 0;
}
return DefWindowProc(window_handle_, message, wparam, lparam);
}
void Win32Window::Destroy() {
OnDestroy();
if (window_handle_) {
DestroyWindow(window_handle_);
window_handle_ = nullptr;
}
if (g_active_window_count == 0) {
WindowClassRegistrar::GetInstance()->UnregisterWindowClass();
}
}
Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
return reinterpret_cast<Win32Window*>(
GetWindowLongPtr(window, GWLP_USERDATA));
}
void Win32Window::SetChildContent(HWND content) {
child_content_ = content;
SetParent(content, window_handle_);
RECT frame = GetClientArea();
MoveWindow(content, frame.left, frame.top, frame.right - frame.left,
frame.bottom - frame.top, true);
SetFocus(child_content_);
}
RECT Win32Window::GetClientArea() {
RECT frame;
GetClientRect(window_handle_, &frame);
return frame;
}
HWND Win32Window::GetHandle() {
return window_handle_;
}
void Win32Window::SetQuitOnClose(bool quit_on_close) {
quit_on_close_ = quit_on_close;
}
bool Win32Window::OnCreate() {
// No-op; provided for subclasses.
return true;
}
void Win32Window::OnDestroy() {
// No-op; provided for subclasses.
}

View File

@ -0,0 +1,98 @@
#ifndef RUNNER_WIN32_WINDOW_H_
#define RUNNER_WIN32_WINDOW_H_
#include <windows.h>
#include <functional>
#include <memory>
#include <string>
// A class abstraction for a high DPI-aware Win32 Window. Intended to be
// inherited from by classes that wish to specialize with custom
// rendering and input handling
class Win32Window {
public:
struct Point {
unsigned int x;
unsigned int y;
Point(unsigned int x, unsigned int y) : x(x), y(y) {}
};
struct Size {
unsigned int width;
unsigned int height;
Size(unsigned int width, unsigned int height)
: width(width), height(height) {}
};
Win32Window();
virtual ~Win32Window();
// Creates and shows a win32 window with |title| and position and size using
// |origin| and |size|. New windows are created on the default monitor. Window
// sizes are specified to the OS in physical pixels, hence to ensure a
// consistent size to will treat the width height passed in to this function
// as logical pixels and scale to appropriate for the default monitor. Returns
// true if the window was created successfully.
bool CreateAndShow(const std::wstring& title,
const Point& origin,
const Size& size);
// Release OS resources associated with window.
void Destroy();
// Inserts |content| into the window tree.
void SetChildContent(HWND content);
// Returns the backing Window handle to enable clients to set icon and other
// window properties. Returns nullptr if the window has been destroyed.
HWND GetHandle();
// If true, closing this window will quit the application.
void SetQuitOnClose(bool quit_on_close);
// Return a RECT representing the bounds of the current client area.
RECT GetClientArea();
protected:
// Processes and route salient window messages for mouse handling,
// size change and DPI. Delegates handling of these to member overloads that
// inheriting classes can handle.
virtual LRESULT MessageHandler(HWND window,
UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept;
// Called when CreateAndShow is called, allowing subclass window-related
// setup. Subclasses should return false if setup fails.
virtual bool OnCreate();
// Called when Destroy is called.
virtual void OnDestroy();
private:
friend class WindowClassRegistrar;
// OS callback called by message pump. Handles the WM_NCCREATE message which
// is passed when the non-client area is being created and enables automatic
// non-client DPI scaling so that the non-client area automatically
// responsponds to changes in DPI. All other messages are handled by
// MessageHandler.
static LRESULT CALLBACK WndProc(HWND const window,
UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept;
// Retrieves a class instance pointer for |window|
static Win32Window* GetThisFromHandle(HWND const window) noexcept;
bool quit_on_close_ = false;
// window handle for top level window.
HWND window_handle_ = nullptr;
// window handle for hosted content.
HWND child_content_ = nullptr;
};
#endif // RUNNER_WIN32_WINDOW_H_