UX: change search button appBar with home

This commit is contained in:
poka 2023-11-24 22:58:34 +01:00
parent 6d16b99cbf
commit 5dbec1ac53
2 changed files with 127 additions and 134 deletions

View File

@ -28,7 +28,6 @@ class TransactionInProgress extends StatelessWidget {
final myWalletProvider = final myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false); Provider.of<MyWalletsProvider>(context, listen: false);
bool isValid = false; bool isValid = false;
bool isLoading = true; bool isLoading = true;
final result = sub.transactionStatus; final result = sub.transactionStatus;
@ -51,6 +50,7 @@ class TransactionInProgress extends StatelessWidget {
'revokeIdty': 'revokeAdhesion'.tr(), 'revokeIdty': 'revokeAdhesion'.tr(),
'identityMigration': 'identityMigration'.tr(), 'identityMigration': 'identityMigration'.tr(),
}; };
String resultText = ''; String resultText = '';
final Map<String, String> resultMap = { final Map<String, String> resultMap = {
'': 'sending'.tr(), '': 'sending'.tr(),
@ -93,145 +93,146 @@ class TransactionInProgress extends StatelessWidget {
log.d("$transType :: ${actionMap[transType]} :: $result"); log.d("$transType :: ${actionMap[transType]} :: $result");
return WillPopScope( return WillPopScope(
onWillPop: () { onWillPop: () {
sub.transactionStatus = ''; sub.transactionStatus = '';
Navigator.pop(context);
if (transType == 'identityMigration') {
Navigator.pop(context); Navigator.pop(context);
if (transType == 'identityMigration') { }
Navigator.pop(context); return Future<bool>.value(true);
} },
return Future<bool>.value(true); child: Scaffold(
}, backgroundColor: backgroundColor,
child: Scaffold( appBar: AppBar(
backgroundColor: backgroundColor, toolbarHeight: 60 * ratio,
appBar: AppBar( elevation: 0,
toolbarHeight: 60 * ratio, automaticallyImplyLeading: false,
elevation: 0, title: SizedBox(
automaticallyImplyLeading: false, height: 22,
title: SizedBox( child: Row(
height: 22, mainAxisAlignment: MainAxisAlignment.center,
child: Row( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.center, Text('extrinsicInProgress'.tr(args: [
children: <Widget>[ actionMap[transType] ?? 'strangeTransaction'.tr()
Text('extrinsicInProgress'.tr(args: [ ]))
actionMap[transType] ?? 'strangeTransaction'.tr() ]),
])) )),
]), body: SafeArea(
)), child: Align(
body: SafeArea( alignment: FractionalOffset.bottomCenter,
child: Align( child: Column(children: <Widget>[
alignment: FractionalOffset.bottomCenter, Container(
child: Column(children: <Widget>[ width: double.infinity,
Container( decoration: const BoxDecoration(
width: double.infinity, gradient: LinearGradient(
decoration: const BoxDecoration( begin: Alignment.topCenter,
gradient: LinearGradient( end: Alignment.bottomCenter,
begin: Alignment.topCenter, colors: [
end: Alignment.bottomCenter, yellowC,
colors: [ backgroundColor,
yellowC, ],
backgroundColor, )),
], child: Column(children: <Widget>[
)), const SizedBox(height: 10),
child: Column(children: <Widget>[ if (transType == 'pay')
const SizedBox(height: 10),
if (transType == 'pay')
Text(
isUdUnit
? 'ud'.tr(args: ['$amount '])
: '$amount $currencyName',
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600),
),
if (transType == 'pay') const SizedBox(height: 10),
Text( Text(
'fromMinus'.tr(), isUdUnit
textAlign: TextAlign.center, ? 'ud'.tr(args: ['$amount '])
style: const TextStyle(fontSize: 18), : '$amount $currencyName',
),
Text(
from,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600), fontSize: 18, fontWeight: FontWeight.w600),
), ),
const SizedBox(height: 10), if (transType == 'pay') const SizedBox(height: 10),
Text( Text(
'toMinus'.tr(), 'fromMinus'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18), style: const TextStyle(fontSize: 18),
),
Text(
toUsername ?? to,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600),
),
const SizedBox(height: 20),
]),
),
// const SizedBox(height: 20, width: double.infinity),
const Spacer(),
Column(children: [
Visibility(
visible: isLoading,
child: const SizedBox(
height: 18,
width: 18,
child: CircularProgressIndicator(
color: orangeC,
strokeWidth: 2,
),
),
), ),
Visibility( Text(
visible: !isLoading, from,
child: Icon( textAlign: TextAlign.center,
isValid ? Icons.done_all : Icons.close, style: const TextStyle(
size: 35, fontSize: 18, fontWeight: FontWeight.w600),
color: isValid ? Colors.greenAccent : Colors.redAccent,
),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
resultText, 'toMinus'.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 19 * ratio), style: const TextStyle(fontSize: 18),
), ),
Text(
toUsername ?? to,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18, fontWeight: FontWeight.w600),
),
const SizedBox(height: 20),
]), ]),
const Spacer(), ),
Expanded( // const SizedBox(height: 20, width: double.infinity),
child: Align( const Spacer(),
alignment: Alignment.bottomCenter, Column(children: [
child: SizedBox( Visibility(
width: 380 * ratio, visible: isLoading,
height: 60 * ratio, child: const SizedBox(
child: ElevatedButton( height: 18,
key: keyCloseTransactionScreen, width: 18,
style: ElevatedButton.styleFrom( child: CircularProgressIndicator(
foregroundColor: Colors.white, elevation: 4, color: orangeC,
backgroundColor: orangeC, // foreground strokeWidth: 2,
), ),
onPressed: () { ),
),
Visibility(
visible: !isLoading,
child: Icon(
isValid ? Icons.done_all : Icons.close,
size: 35,
color: isValid ? Colors.greenAccent : Colors.redAccent,
),
),
const SizedBox(height: 10),
Text(
resultText,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 19 * ratio),
),
]),
const Spacer(),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
width: 380 * ratio,
height: 60 * ratio,
child: ElevatedButton(
key: keyCloseTransactionScreen,
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white, elevation: 4,
backgroundColor: orangeC, // foreground
),
onPressed: () {
Navigator.pop(context);
sub.transactionStatus = '';
if (transType == 'identityMigration') {
Navigator.pop(context); Navigator.pop(context);
sub.transactionStatus = ''; }
if (transType == 'identityMigration') { },
Navigator.pop(context); child: Text(
} 'close'.tr(),
}, style: TextStyle(
child: Text( fontSize: 23 * ratio,
'close'.tr(), fontWeight: FontWeight.w600),
style: TextStyle(
fontSize: 23 * ratio,
fontWeight: FontWeight.w600),
),
), ),
), ),
), ),
), ),
SizedBox(height: isTall ? 80 : 20) ),
])), SizedBox(height: isTall ? 80 : 20)
), ])),
)); ),
),
);
} }
} }

View File

@ -1,7 +1,6 @@
// ignore_for_file: use_build_context_synchronously // ignore_for_file: use_build_context_synchronously
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/wallet_data.dart'; import 'package:gecko/models/wallet_data.dart';
@ -10,7 +9,6 @@ import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/providers/search.dart'; import 'package:gecko/providers/search.dart';
import 'package:gecko/providers/wallets_profiles.dart'; import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart'; import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:gecko/screens/search.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class GeckoBottomAppBar extends StatelessWidget { class GeckoBottomAppBar extends StatelessWidget {
@ -40,23 +38,17 @@ class GeckoBottomAppBar extends StatelessWidget {
const SizedBox(width: 11), const SizedBox(width: 11),
IconButton( IconButton(
key: keyAppBarSearch, key: keyAppBarSearch,
iconSize: 40, iconSize: 55,
icon: const Image(image: AssetImage('assets/loupe-noire.png')), icon: const Icon(Icons.home_outlined),
onPressed: () { onPressed: () {
searchProvider.reload(); searchProvider.reload();
Navigator.popUntil( Navigator.popUntil(
context, context,
ModalRoute.withName('/'), ModalRoute.withName('/'),
); );
Navigator.push(
context,
MaterialPageRoute(builder: (homeContext) {
return const SearchScreen();
}),
);
}, },
), ),
const SizedBox(width: 22), const SizedBox(width: 12),
const Spacer(), const Spacer(),
IconButton( IconButton(
key: keyAppBarQrcode, key: keyAppBarQrcode,