2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
2023-05-09 21:57:40 +00:00
|
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
2022-09-19 20:18:31 +00:00
|
|
|
import 'package:stackwallet/utilities/util.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
class AppBarIconButton extends StatelessWidget {
|
|
|
|
const AppBarIconButton({
|
|
|
|
Key? key,
|
|
|
|
required this.icon,
|
|
|
|
required this.onPressed,
|
|
|
|
this.color,
|
|
|
|
// this.circularBorderRadius = 10.0,
|
|
|
|
this.size = 36.0,
|
|
|
|
this.shadows = const [],
|
2023-04-28 18:21:30 +00:00
|
|
|
this.semanticsLabel = "Button",
|
2022-08-26 08:11:35 +00:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final Widget icon;
|
|
|
|
final VoidCallback? onPressed;
|
|
|
|
final Color? color;
|
|
|
|
// final double circularBorderRadius;
|
|
|
|
final double size;
|
|
|
|
final List<BoxShadow> shadows;
|
2023-04-28 18:21:30 +00:00
|
|
|
final String semanticsLabel;
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
2023-05-09 21:57:40 +00:00
|
|
|
height: size,
|
|
|
|
width: size,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(1000),
|
|
|
|
color:
|
|
|
|
color ?? Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
boxShadow: shadows,
|
|
|
|
),
|
|
|
|
child: Semantics(
|
2023-04-27 18:14:04 +00:00
|
|
|
excludeSemantics: true,
|
2023-04-28 18:21:30 +00:00
|
|
|
label: semanticsLabel,
|
2023-04-27 18:14:04 +00:00
|
|
|
child: MaterialButton(
|
2023-05-09 21:57:40 +00:00
|
|
|
splashColor: Theme.of(context).extension<StackColors>()!.highlight,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(1000),
|
|
|
|
),
|
|
|
|
onPressed: onPressed,
|
|
|
|
child: icon,
|
2023-04-27 18:14:04 +00:00
|
|
|
),
|
2023-05-09 21:57:40 +00:00
|
|
|
));
|
2022-08-26 08:11:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class AppBarBackButton extends StatelessWidget {
|
2022-09-26 20:21:13 +00:00
|
|
|
const AppBarBackButton({
|
|
|
|
Key? key,
|
|
|
|
this.onPressed,
|
|
|
|
this.isCompact = false,
|
2022-10-31 15:45:42 +00:00
|
|
|
this.size,
|
|
|
|
this.iconSize,
|
2023-04-28 18:21:30 +00:00
|
|
|
this.semanticsLabel = "Back Button. Takes Back To Previous Page.",
|
2022-09-26 20:21:13 +00:00
|
|
|
}) : super(key: key);
|
2022-08-26 08:11:35 +00:00
|
|
|
|
2022-09-18 16:14:27 +00:00
|
|
|
final VoidCallback? onPressed;
|
2022-09-26 20:21:13 +00:00
|
|
|
final bool isCompact;
|
2022-10-31 15:45:42 +00:00
|
|
|
final double? size;
|
|
|
|
final double? iconSize;
|
2023-04-28 18:21:30 +00:00
|
|
|
final String semanticsLabel;
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-19 20:18:31 +00:00
|
|
|
final isDesktop = Util.isDesktop;
|
2022-08-26 08:11:35 +00:00
|
|
|
return Padding(
|
2023-05-09 21:57:40 +00:00
|
|
|
padding: isDesktop
|
|
|
|
? const EdgeInsets.symmetric(
|
|
|
|
vertical: 20,
|
|
|
|
horizontal: 24,
|
|
|
|
)
|
|
|
|
: const EdgeInsets.all(10),
|
|
|
|
child: AppBarIconButton(
|
|
|
|
semanticsLabel: semanticsLabel,
|
2023-04-27 18:14:04 +00:00
|
|
|
size: size ??
|
|
|
|
(isDesktop
|
|
|
|
? isCompact
|
2023-05-09 21:57:40 +00:00
|
|
|
? 42
|
|
|
|
: 56
|
2023-04-27 18:14:04 +00:00
|
|
|
: 32),
|
|
|
|
color: isDesktop
|
|
|
|
? Theme.of(context).extension<StackColors>()!.textFieldDefaultBG
|
|
|
|
: Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
shadows: const [],
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
Assets.svg.arrowLeft,
|
|
|
|
width: iconSize ?? (isCompact ? 18 : 24),
|
|
|
|
height: iconSize ?? (isCompact ? 18 : 24),
|
2023-05-09 21:57:40 +00:00
|
|
|
color:
|
|
|
|
Theme.of(context).extension<StackColors>()!.topNavIconPrimary,
|
2023-04-27 18:14:04 +00:00
|
|
|
),
|
|
|
|
onPressed: onPressed ?? Navigator.of(context).pop,
|
2023-05-09 21:57:40 +00:00
|
|
|
));
|
2022-08-26 08:11:35 +00:00
|
|
|
}
|
|
|
|
}
|