mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
feat: wrap with semantic widget for talkback
This commit is contained in:
parent
95d57cffc1
commit
6522d36c7b
15 changed files with 253 additions and 187 deletions
|
@ -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,
|
||||||
|
|
|
@ -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 =
|
||||||
|
|
|
@ -140,6 +140,7 @@ class _NewWalletRecoveryPhraseViewState
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "Copy Button. Copies The Recovery Phrase To Clipboard.",
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.background,
|
.background,
|
||||||
|
|
|
@ -87,6 +87,7 @@ class _NewWalletRecoveryPhraseWarningViewState
|
||||||
right: 10,
|
right: 10,
|
||||||
),
|
),
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "Question Button. Openes A Dialog For Recovery Phrase Explanation.",
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
Assets.svg.circleQuestion,
|
Assets.svg.circleQuestion,
|
||||||
width: 20,
|
width: 20,
|
||||||
|
|
|
@ -636,6 +636,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "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(
|
||||||
|
label: "Paste Button. Pastes From Clipboard For Restoring Wallet.",
|
||||||
key: const Key("restoreWalletPasteButton"),
|
key: const Key("restoreWalletPasteButton"),
|
||||||
size: 36,
|
size: 36,
|
||||||
shadows: const [],
|
shadows: const [],
|
||||||
|
|
|
@ -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,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -191,6 +191,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "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(
|
||||||
|
label: "Settings Button. Takes To Settings Page.",
|
||||||
key: const Key("walletsViewSettingsButton"),
|
key: const Key("walletsViewSettingsButton"),
|
||||||
size: 36,
|
size: 36,
|
||||||
shadows: const [],
|
shadows: const [],
|
||||||
|
|
|
@ -39,6 +39,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";
|
||||||
|
@ -53,6 +54,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();
|
||||||
|
@ -245,6 +248,10 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
|
||||||
),
|
),
|
||||||
CustomPinPut(
|
CustomPinPut(
|
||||||
customKey: CustomKey(
|
customKey: CustomKey(
|
||||||
|
customKeyLabel: Platform.isIOS
|
||||||
|
? "Face ID Button. Checks Face ID."
|
||||||
|
: "Fingerprint Button. Checks Fingerprint."
|
||||||
|
,
|
||||||
onPressed: _checkUseBiometrics,
|
onPressed: _checkUseBiometrics,
|
||||||
iconAssetName: Platform.isIOS
|
iconAssetName: Platform.isIOS
|
||||||
? Assets.svg.faceId
|
? Assets.svg.faceId
|
||||||
|
|
|
@ -143,6 +143,7 @@ class _ReceiveViewState extends ConsumerState<ReceiveView> {
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "Adress 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 [],
|
||||||
|
|
|
@ -980,6 +980,7 @@ class _SendViewState extends ConsumerState<SendView> {
|
||||||
children: [
|
children: [
|
||||||
_addressToggleFlag
|
_addressToggleFlag
|
||||||
? TextFieldIconButton(
|
? TextFieldIconButton(
|
||||||
|
label: "Clear Button. Clears The Address Field Input.",
|
||||||
key: const Key(
|
key: const Key(
|
||||||
"sendViewClearAddressFieldButtonKey"),
|
"sendViewClearAddressFieldButtonKey"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -996,6 +997,7 @@ class _SendViewState extends ConsumerState<SendView> {
|
||||||
child: const XIcon(),
|
child: const XIcon(),
|
||||||
)
|
)
|
||||||
: TextFieldIconButton(
|
: TextFieldIconButton(
|
||||||
|
label: "Paste Button. Pastes From Clipboard To Address Field Input.",
|
||||||
key: const Key(
|
key: const Key(
|
||||||
"sendViewPasteAddressFieldButtonKey"),
|
"sendViewPasteAddressFieldButtonKey"),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
@ -1045,6 +1047,7 @@ class _SendViewState extends ConsumerState<SendView> {
|
||||||
),
|
),
|
||||||
if (sendToController.text.isEmpty)
|
if (sendToController.text.isEmpty)
|
||||||
TextFieldIconButton(
|
TextFieldIconButton(
|
||||||
|
label: "Address Book Button. Opens Address Book For Address Field.",
|
||||||
key: const Key(
|
key: const Key(
|
||||||
"sendViewAddressBookButtonKey"),
|
"sendViewAddressBookButtonKey"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -1057,6 +1060,7 @@ class _SendViewState extends ConsumerState<SendView> {
|
||||||
),
|
),
|
||||||
if (sendToController.text.isEmpty)
|
if (sendToController.text.isEmpty)
|
||||||
TextFieldIconButton(
|
TextFieldIconButton(
|
||||||
|
label: "Scan QR Button. Opens Camera For Scanning QR Code.",
|
||||||
key: const Key(
|
key: const Key(
|
||||||
"sendViewScanQrButtonKey"),
|
"sendViewScanQrButtonKey"),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
|
|
@ -117,58 +117,62 @@ 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 Page.",
|
||||||
? 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();
|
.getManagerProvider(widget.walletId);
|
||||||
ref
|
final isRefreshing = ref.read(managerProvider).isRefreshing;
|
||||||
.read(managerProvider)
|
if (!isRefreshing) {
|
||||||
.refresh()
|
_spinController?.repeat();
|
||||||
.then((_) => _spinController?.stop());
|
ref
|
||||||
|
.read(managerProvider)
|
||||||
|
.refresh()
|
||||||
|
.then((_) => _spinController?.stop());
|
||||||
|
}
|
||||||
|
} 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: RotationTransition(
|
||||||
borderRadius: BorderRadius.circular(
|
turns: _spinAnimation,
|
||||||
Constants.size.circularBorderRadius,
|
child: SvgPicture.asset(
|
||||||
|
Assets.svg.arrowRotate,
|
||||||
|
width: isDesktop ? 12 : 24,
|
||||||
|
height: isDesktop ? 12 : 24,
|
||||||
|
color: widget.overrideIconColor != null
|
||||||
|
? widget.overrideIconColor!
|
||||||
|
: isDesktop
|
||||||
|
? Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultSearchIconRight
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFavoriteCard,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: RotationTransition(
|
)
|
||||||
turns: _spinAnimation,
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
Assets.svg.arrowRotate,
|
|
||||||
width: isDesktop ? 12 : 24,
|
|
||||||
height: isDesktop ? 12 : 24,
|
|
||||||
color: widget.overrideIconColor != null
|
|
||||||
? widget.overrideIconColor!
|
|
||||||
: isDesktop
|
|
||||||
? Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textFieldDefaultSearchIconRight
|
|
||||||
: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textFavoriteCard,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,6 +474,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "Network Button. Takes To Network Status Page.",
|
||||||
key: const Key("walletViewRadioButton"),
|
key: const Key("walletViewRadioButton"),
|
||||||
size: 36,
|
size: 36,
|
||||||
shadows: const [],
|
shadows: const [],
|
||||||
|
@ -503,6 +504,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "Notifications Button. Takes To Notifications Page.",
|
||||||
key: const Key("walletViewAlertsButton"),
|
key: const Key("walletViewAlertsButton"),
|
||||||
size: 36,
|
size: 36,
|
||||||
shadows: const [],
|
shadows: const [],
|
||||||
|
@ -570,6 +572,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: AppBarIconButton(
|
child: AppBarIconButton(
|
||||||
|
label: "Settings Button. Takes To Wallet Settings Page.",
|
||||||
key: const Key("walletViewSettingsButton"),
|
key: const Key("walletViewSettingsButton"),
|
||||||
size: 36,
|
size: 36,
|
||||||
shadows: const [],
|
shadows: const [],
|
||||||
|
|
|
@ -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.label = "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 label;
|
||||||
|
|
||||||
@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: label,
|
||||||
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.label = "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 label;
|
||||||
|
|
||||||
@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 ??
|
label: label,
|
||||||
(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,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,15 +139,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,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -197,10 +201,12 @@ class CustomKey extends StatelessWidget {
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.iconAssetName,
|
this.iconAssetName,
|
||||||
|
this.customKeyLabel = "Button",
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
final String? iconAssetName;
|
final String? iconAssetName;
|
||||||
|
final String customKeyLabel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -212,26 +218,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: customKeyLabel,
|
||||||
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.label = "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 label;
|
||||||
|
|
||||||
@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.label,
|
||||||
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,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue