2022-08-26 08:11:35 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
2022-09-22 23:48:50 +00:00
|
|
|
import 'package:stackwallet/utilities/theme/stack_colors.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 [],
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final Widget icon;
|
|
|
|
final VoidCallback? onPressed;
|
|
|
|
final Color? color;
|
|
|
|
// final double circularBorderRadius;
|
|
|
|
final double size;
|
|
|
|
final List<BoxShadow> shadows;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
height: size,
|
|
|
|
width: size,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(1000),
|
2022-09-22 23:48:50 +00:00
|
|
|
color: color ?? Theme.of(context).extension<StackColors>()!.background,
|
2022-08-26 08:11:35 +00:00
|
|
|
boxShadow: shadows,
|
|
|
|
),
|
|
|
|
child: MaterialButton(
|
2022-09-22 23:48:50 +00:00
|
|
|
splashColor: Theme.of(context).extension<StackColors>()!.highlight,
|
2022-08-26 08:11:35 +00:00
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(1000),
|
|
|
|
),
|
|
|
|
onPressed: onPressed,
|
|
|
|
child: icon,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class AppBarBackButton extends StatelessWidget {
|
2022-09-18 16:14:27 +00:00
|
|
|
const AppBarBackButton({Key? key, this.onPressed}) : super(key: key);
|
2022-08-26 08:11:35 +00:00
|
|
|
|
2022-09-18 16:14:27 +00:00
|
|
|
final VoidCallback? onPressed;
|
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(
|
2022-09-15 19:48:28 +00:00
|
|
|
padding: isDesktop
|
|
|
|
? const EdgeInsets.symmetric(
|
|
|
|
vertical: 20,
|
|
|
|
horizontal: 24,
|
|
|
|
)
|
|
|
|
: const EdgeInsets.all(10),
|
2022-08-26 08:11:35 +00:00
|
|
|
child: AppBarIconButton(
|
2022-09-15 19:48:28 +00:00
|
|
|
size: isDesktop ? 56 : 32,
|
|
|
|
color: isDesktop
|
2022-09-22 23:48:50 +00:00
|
|
|
? Theme.of(context).extension<StackColors>()!.textFieldDefaultBG
|
|
|
|
: Theme.of(context).extension<StackColors>()!.background,
|
2022-08-26 08:11:35 +00:00
|
|
|
shadows: const [],
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
Assets.svg.arrowLeft,
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
2022-09-22 23:48:50 +00:00
|
|
|
color: Theme.of(context).extension<StackColors>()!.topNavIconPrimary,
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
2022-09-18 16:14:27 +00:00
|
|
|
onPressed: onPressed ?? Navigator.of(context).pop,
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|