Merge branch 'ui-fixes' of https://github.com/cypherstack/stack_wallet into ui-fixes

This commit is contained in:
ryleedavis 2023-05-03 08:28:39 -06:00
commit 49d3dcef4f
15 changed files with 247 additions and 185 deletions

View file

@ -333,53 +333,57 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius, Constants.size.circularBorderRadius,
), ),
child: TextField( child: Semantics(
autofocus: isDesktop, label: "Search Text Field. Inputs Text To Search In Wallets.",
autocorrect: !isDesktop, excludeSemantics: true,
enableSuggestions: !isDesktop, child: TextField(
controller: _searchFieldController, autofocus: isDesktop,
focusNode: _searchFocusNode, autocorrect: !isDesktop,
onChanged: (value) => setState(() => _searchTerm = value), enableSuggestions: !isDesktop,
style: STextStyles.field(context), controller: _searchFieldController,
decoration: standardInputDecoration( focusNode: _searchFocusNode,
"Search", onChanged: (value) => setState(() => _searchTerm = value),
_searchFocusNode, style: STextStyles.field(context),
context, decoration: standardInputDecoration(
desktopMed: isDesktop, "Search",
).copyWith( _searchFocusNode,
prefixIcon: Padding( context,
padding: const EdgeInsets.symmetric( desktopMed: isDesktop,
horizontal: 10, ).copyWith(
vertical: 16, prefixIcon: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 16,
),
child: SvgPicture.asset(
Assets.svg.search,
width: 16,
height: 16,
),
), ),
child: SvgPicture.asset( suffixIcon: _searchFieldController.text.isNotEmpty
Assets.svg.search, ? Padding(
width: 16, padding: const EdgeInsets.only(right: 0),
height: 16, child: UnconstrainedBox(
), child: Row(
), children: [
suffixIcon: _searchFieldController.text.isNotEmpty TextFieldIconButton(
? Padding( child: const XIcon(),
padding: const EdgeInsets.only(right: 0), onTap: () async {
child: UnconstrainedBox( setState(() {
child: Row( _searchFieldController.text = "";
children: [ _searchTerm = "";
TextFieldIconButton( });
child: const XIcon(), },
onTap: () async {
setState(() {
_searchFieldController.text = "";
_searchTerm = "";
});
},
),
],
), ),
), ],
) ),
: null, ),
)
: null,
),
), ),
), )
), ),
const SizedBox( const SizedBox(
height: 10, height: 10,

View file

@ -238,14 +238,22 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
TextFieldIconButton( TextFieldIconButton(
key: const Key("genRandomWalletNameButtonKey"), key: const Key("genRandomWalletNameButtonKey"),
child: _showDiceIcon child: _showDiceIcon
? DiceIcon( ? Semantics(
width: isDesktop ? 20 : 17, label: "Generate Random Wallet Name Button. Generates A Random Name For Wallet.",
height: isDesktop ? 20 : 17, excludeSemantics: true,
) child: DiceIcon(
: XIcon( width: isDesktop ? 20 : 17,
height: isDesktop ? 20 : 17,
),
)
: Semantics(
label: "Generate Random Wallet Name Button. Generates A Random Name For Wallet.",
excludeSemantics: true,
child: XIcon(
width: isDesktop ? 21 : 18, width: isDesktop ? 21 : 18,
height: isDesktop ? 21 : 18, height: isDesktop ? 21 : 18,
), ),
),
onTap: () async { onTap: () async {
if (_showDiceIcon) { if (_showDiceIcon) {
textEditingController.text = textEditingController.text =

View file

@ -140,6 +140,7 @@ class _NewWalletRecoveryPhraseViewState
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Copy Button. Copies The Recovery Phrase To Clipboard.",
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.background, .background,

View file

@ -87,6 +87,7 @@ class _NewWalletRecoveryPhraseWarningViewState
right: 10, right: 10,
), ),
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Question Button. Opens A Dialog For Recovery Phrase Explanation.",
icon: SvgPicture.asset( icon: SvgPicture.asset(
Assets.svg.circleQuestion, Assets.svg.circleQuestion,
width: 20, width: 20,

View file

@ -636,6 +636,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "View QR Code Button. Opens Camera To Scan QR Code For Restoring Wallet.",
key: const Key("restoreWalletViewQrCodeButton"), key: const Key("restoreWalletViewQrCodeButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -662,6 +663,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Paste Button. Pastes From Clipboard For Restoring Wallet.",
key: const Key("restoreWalletPasteButton"), key: const Key("restoreWalletPasteButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -781,31 +781,35 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
cursor: SystemMouseCursors.click, cursor: SystemMouseCursors.click,
child: child, child: child,
), ),
child: RoundedContainer( child: Semantics(
padding: isDesktop label: "Swap Button. Reverse The Exchange Currencies.",
? const EdgeInsets.all(6) excludeSemantics: true,
: const EdgeInsets.all(2), child: RoundedContainer(
color: Theme.of(context) padding: isDesktop
.extension<StackColors>()! ? const EdgeInsets.all(6)
.buttonBackSecondary, : const EdgeInsets.all(2),
radiusMultiplier: 0.75, color: Theme.of(context)
child: GestureDetector( .extension<StackColors>()!
onTap: () async { .buttonBackSecondary,
await _swap(); radiusMultiplier: 0.75,
}, child: GestureDetector(
child: Padding( onTap: () async {
padding: const EdgeInsets.all(4), await _swap();
child: SvgPicture.asset( },
Assets.svg.swap, child: Padding(
width: 20, padding: const EdgeInsets.all(4),
height: 20, child: SvgPicture.asset(
color: Theme.of(context) Assets.svg.swap,
.extension<StackColors>()! width: 20,
.accentColorDark, height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
), ),
), ),
), ),
), )
), ),
], ],
), ),

View file

@ -191,6 +191,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Notifications Button. Takes To Notifications Page.",
key: const Key("walletsViewAlertsButton"), key: const Key("walletsViewAlertsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -254,6 +255,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Settings Button. Takes To Settings Page.",
key: const Key("walletsViewSettingsButton"), key: const Key("walletsViewSettingsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -38,6 +38,7 @@ class LockscreenView extends ConsumerStatefulWidget {
this.routeOnSuccessArguments, this.routeOnSuccessArguments,
this.biometrics = const Biometrics(), this.biometrics = const Biometrics(),
this.onSuccess, this.onSuccess,
this.customKeyLabel = "Button",
}) : super(key: key); }) : super(key: key);
static const String routeName = "/lockscreen"; static const String routeName = "/lockscreen";
@ -52,6 +53,8 @@ class LockscreenView extends ConsumerStatefulWidget {
final String biometricsCancelButtonString; final String biometricsCancelButtonString;
final Biometrics biometrics; final Biometrics biometrics;
final VoidCallback? onSuccess; final VoidCallback? onSuccess;
final String customKeyLabel;
@override @override
ConsumerState<LockscreenView> createState() => _LockscreenViewState(); ConsumerState<LockscreenView> createState() => _LockscreenViewState();

View file

@ -143,6 +143,7 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Address List Pop-up Button. Opens A Pop-up For Adress List Button.",
key: const Key("walletNetworkSettingsAddNewNodeViewButton"), key: const Key("walletNetworkSettingsAddNewNodeViewButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -981,6 +981,7 @@ class _SendViewState extends ConsumerState<SendView> {
children: [ children: [
_addressToggleFlag _addressToggleFlag
? TextFieldIconButton( ? TextFieldIconButton(
semanticsLabel: "Clear Button. Clears The Address Field Input.",
key: const Key( key: const Key(
"sendViewClearAddressFieldButtonKey"), "sendViewClearAddressFieldButtonKey"),
onTap: () { onTap: () {
@ -997,6 +998,7 @@ class _SendViewState extends ConsumerState<SendView> {
child: const XIcon(), child: const XIcon(),
) )
: TextFieldIconButton( : TextFieldIconButton(
semanticsLabel: "Paste Button. Pastes From Clipboard To Address Field Input.",
key: const Key( key: const Key(
"sendViewPasteAddressFieldButtonKey"), "sendViewPasteAddressFieldButtonKey"),
onTap: () async { onTap: () async {
@ -1046,6 +1048,7 @@ class _SendViewState extends ConsumerState<SendView> {
), ),
if (sendToController.text.isEmpty) if (sendToController.text.isEmpty)
TextFieldIconButton( TextFieldIconButton(
semanticsLabel: "Address Book Button. Opens Address Book For Address Field.",
key: const Key( key: const Key(
"sendViewAddressBookButtonKey"), "sendViewAddressBookButtonKey"),
onTap: () { onTap: () {
@ -1058,6 +1061,7 @@ class _SendViewState extends ConsumerState<SendView> {
), ),
if (sendToController.text.isEmpty) if (sendToController.text.isEmpty)
TextFieldIconButton( TextFieldIconButton(
semanticsLabel: "Scan QR Button. Opens Camera For Scanning QR Code.",
key: const Key( key: const Key(
"sendViewScanQrButtonKey"), "sendViewScanQrButtonKey"),
onTap: () async { onTap: () async {

View file

@ -99,56 +99,60 @@ class _RefreshButtonState extends ConsumerState<WalletRefreshButton> {
return SizedBox( return SizedBox(
height: isDesktop ? 22 : 36, height: isDesktop ? 22 : 36,
width: isDesktop ? 22 : 36, width: isDesktop ? 22 : 36,
child: MaterialButton( child: Semantics(
color: isDesktop label: "Refresh Button. Refreshes The Values In Summary.",
? Theme.of(context).extension<StackColors>()!.buttonBackSecondary excludeSemantics: true,
: null, child: MaterialButton(
splashColor: Theme.of(context).extension<StackColors>()!.highlight, color: isDesktop
onPressed: () { ? Theme.of(context).extension<StackColors>()!.buttonBackSecondary
if (widget.tokenContractAddress == null) { : null,
final managerProvider = ref splashColor: Theme.of(context).extension<StackColors>()!.highlight,
.read(walletsChangeNotifierProvider) onPressed: () {
.getManagerProvider(widget.walletId); if (widget.tokenContractAddress == null) {
final isRefreshing = ref.read(managerProvider).isRefreshing; final managerProvider = ref
if (!isRefreshing) { .read(walletsChangeNotifierProvider)
_spinController.repeat?.call(); .getManagerProvider(widget.walletId);
ref final isRefreshing = ref.read(managerProvider).isRefreshing;
.read(managerProvider) if (!isRefreshing) {
.refresh() _spinController.repeat?.call();
.then((_) => _spinController.stop?.call()); ref
.read(managerProvider)
.refresh()
.then((_) => _spinController.stop?.call());
}
} else {
if (!ref.read(tokenServiceProvider)!.isRefreshing) {
ref.read(tokenServiceProvider)!.refresh();
}
} }
} else { },
if (!ref.read(tokenServiceProvider)!.isRefreshing) { elevation: 0,
ref.read(tokenServiceProvider)!.refresh(); highlightElevation: 0,
} hoverElevation: 0,
} padding: EdgeInsets.zero,
}, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
elevation: 0, shape: RoundedRectangleBorder(
highlightElevation: 0, borderRadius: BorderRadius.circular(
hoverElevation: 0, Constants.size.circularBorderRadius,
padding: EdgeInsets.zero, ),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ),
shape: RoundedRectangleBorder( child: RotatingArrows(
borderRadius: BorderRadius.circular( spinByDefault: widget.initialSyncStatus == WalletSyncStatus.syncing,
Constants.size.circularBorderRadius, width: isDesktop ? 12 : 24,
height: isDesktop ? 12 : 24,
controller: _spinController,
color: widget.overrideIconColor != null
? widget.overrideIconColor!
: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultSearchIconRight
: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
), ),
), ),
child: RotatingArrows( )
spinByDefault: widget.initialSyncStatus == WalletSyncStatus.syncing,
width: isDesktop ? 12 : 24,
height: isDesktop ? 12 : 24,
controller: _spinController,
color: widget.overrideIconColor != null
? widget.overrideIconColor!
: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultSearchIconRight
: Theme.of(context)
.extension<StackColors>()!
.textFavoriteCard,
),
),
); );
} }
} }

View file

@ -501,6 +501,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Network Button. Takes To Network Status Page.",
key: const Key("walletViewRadioButton"), key: const Key("walletViewRadioButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -530,6 +531,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Notifications Button. Takes To Notifications Page.",
key: const Key("walletViewAlertsButton"), key: const Key("walletViewAlertsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],
@ -597,6 +599,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
child: AspectRatio( child: AspectRatio(
aspectRatio: 1, aspectRatio: 1,
child: AppBarIconButton( child: AppBarIconButton(
semanticsLabel: "Settings Button. Takes To Wallet Settings Page.",
key: const Key("walletViewSettingsButton"), key: const Key("walletViewSettingsButton"),
size: 36, size: 36,
shadows: const [], shadows: const [],

View file

@ -13,6 +13,7 @@ class AppBarIconButton extends StatelessWidget {
// this.circularBorderRadius = 10.0, // this.circularBorderRadius = 10.0,
this.size = 36.0, this.size = 36.0,
this.shadows = const [], this.shadows = const [],
this.semanticsLabel = "Button",
}) : super(key: key); }) : super(key: key);
final Widget icon; final Widget icon;
@ -21,6 +22,7 @@ class AppBarIconButton extends StatelessWidget {
// final double circularBorderRadius; // final double circularBorderRadius;
final double size; final double size;
final List<BoxShadow> shadows; final List<BoxShadow> shadows;
final String semanticsLabel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -32,16 +34,20 @@ class AppBarIconButton extends StatelessWidget {
color: color ?? Theme.of(context).extension<StackColors>()!.background, color: color ?? Theme.of(context).extension<StackColors>()!.background,
boxShadow: shadows, boxShadow: shadows,
), ),
child: MaterialButton( child: Semantics(
splashColor: Theme.of(context).extension<StackColors>()!.highlight, excludeSemantics: true,
padding: EdgeInsets.zero, label: semanticsLabel,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, child: MaterialButton(
shape: RoundedRectangleBorder( splashColor: Theme.of(context).extension<StackColors>()!.highlight,
borderRadius: BorderRadius.circular(1000), padding: EdgeInsets.zero,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(1000),
),
onPressed: onPressed,
child: icon,
), ),
onPressed: onPressed, )
child: icon,
),
); );
} }
} }
@ -53,12 +59,14 @@ class AppBarBackButton extends StatelessWidget {
this.isCompact = false, this.isCompact = false,
this.size, this.size,
this.iconSize, this.iconSize,
this.semanticsLabel = "Back Button. Takes Back To Previous Page.",
}) : super(key: key); }) : super(key: key);
final VoidCallback? onPressed; final VoidCallback? onPressed;
final bool isCompact; final bool isCompact;
final double? size; final double? size;
final double? iconSize; final double? iconSize;
final String semanticsLabel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -71,24 +79,25 @@ class AppBarBackButton extends StatelessWidget {
) )
: const EdgeInsets.all(10), : const EdgeInsets.all(10),
child: AppBarIconButton( child: AppBarIconButton(
size: size ?? semanticsLabel: semanticsLabel,
(isDesktop size: size ??
? isCompact (isDesktop
? 42 ? isCompact
: 56 ? 42
: 32), : 56
color: isDesktop : 32),
? Theme.of(context).extension<StackColors>()!.textFieldDefaultBG color: isDesktop
: Theme.of(context).extension<StackColors>()!.background, ? Theme.of(context).extension<StackColors>()!.textFieldDefaultBG
shadows: const [], : Theme.of(context).extension<StackColors>()!.background,
icon: SvgPicture.asset( shadows: const [],
Assets.svg.arrowLeft, icon: SvgPicture.asset(
width: iconSize ?? (isCompact ? 18 : 24), Assets.svg.arrowLeft,
height: iconSize ?? (isCompact ? 18 : 24), width: iconSize ?? (isCompact ? 18 : 24),
color: Theme.of(context).extension<StackColors>()!.topNavIconPrimary, height: iconSize ?? (isCompact ? 18 : 24),
), color: Theme.of(context).extension<StackColors>()!.topNavIconPrimary,
onPressed: onPressed ?? Navigator.of(context).pop, ),
), onPressed: onPressed ?? Navigator.of(context).pop,
)
); );
} }
} }

View file

@ -141,15 +141,19 @@ class _BackspaceKeyState extends State<BackspaceKey> {
} }
}); });
}, },
child: Center( child: Semantics(
child: SvgPicture.asset( label: "Backspace Button. Deletes The Last Digit.",
Assets.svg.delete, excludeSemantics: true,
width: 20, child: Center(
height: 20, child: SvgPicture.asset(
color: Assets.svg.delete,
Theme.of(context).extension<StackColors>()!.numpadTextDefault, width: 20,
height: 20,
color:
Theme.of(context).extension<StackColors>()!.numpadTextDefault,
),
), ),
), )
), ),
); );
} }
@ -199,10 +203,12 @@ class CustomKey extends StatelessWidget {
Key? key, Key? key,
required this.onPressed, required this.onPressed,
this.iconAssetName, this.iconAssetName,
this.semanticsLabel = "Button",
}) : super(key: key); }) : super(key: key);
final VoidCallback onPressed; final VoidCallback onPressed;
final String? iconAssetName; final String? iconAssetName;
final String semanticsLabel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -214,26 +220,30 @@ class CustomKey extends StatelessWidget {
color: Theme.of(context).extension<StackColors>()!.numpadBackDefault, color: Theme.of(context).extension<StackColors>()!.numpadBackDefault,
shadows: const [], shadows: const [],
), ),
child: MaterialButton( child: Semantics(
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, label: semanticsLabel,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, excludeSemantics: true,
shape: const StadiumBorder(), child: MaterialButton(
onPressed: () { // splashColor: Theme.of(context).extension<StackColors>()!.highlight,
onPressed.call(); materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
}, shape: const StadiumBorder(),
child: Center( onPressed: () {
child: iconAssetName == null onPressed.call();
? null },
: SvgPicture.asset( child: Center(
iconAssetName!, child: iconAssetName == null
width: 20, ? null
height: 20, : SvgPicture.asset(
color: Theme.of(context) iconAssetName!,
.extension<StackColors>()! width: 20,
.numpadTextDefault, height: 20,
), color: Theme.of(context)
.extension<StackColors>()!
.numpadTextDefault,
),
),
), ),
), )
); );
} }
} }

View file

@ -8,6 +8,7 @@ class TextFieldIconButton extends StatefulWidget {
this.onTap, this.onTap,
required this.child, required this.child,
this.color = Colors.transparent, this.color = Colors.transparent,
this.semanticsLabel = "Button",
}) : super(key: key); }) : super(key: key);
final double width; final double width;
@ -15,6 +16,7 @@ class TextFieldIconButton extends StatefulWidget {
final VoidCallback? onTap; final VoidCallback? onTap;
final Widget child; final Widget child;
final Color color; final Color color;
final String semanticsLabel;
@override @override
State<TextFieldIconButton> createState() => _TextFieldIconButtonState(); State<TextFieldIconButton> createState() => _TextFieldIconButtonState();
@ -36,21 +38,25 @@ class _TextFieldIconButtonState extends State<TextFieldIconButton> {
width: widget.width, width: widget.width,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
child: RawMaterialButton( child: Semantics(
constraints: BoxConstraints( label: widget.semanticsLabel,
minWidth: widget.width, excludeSemantics: true,
minHeight: widget.height, child: RawMaterialButton(
), constraints: BoxConstraints(
onPressed: onTap, minWidth: widget.width,
child: Container( minHeight: widget.height,
width: widget.width, ),
height: widget.height, onPressed: onTap,
color: widget.color, child: Container(
child: Center( width: widget.width,
child: widget.child, height: widget.height,
color: widget.color,
child: Center(
child: widget.child,
),
), ),
), ),
), )
), ),
); );
} }