mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-27 22:09:30 +00:00
113 lines
3.3 KiB
Dart
113 lines
3.3 KiB
Dart
/*
|
|
* 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
|
|
*
|
|
*/
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:stackwallet/themes/stack_colors.dart';
|
|
import 'package:stackwallet/utilities/assets.dart';
|
|
import 'package:stackwallet/utilities/util.dart';
|
|
|
|
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 [],
|
|
this.semanticsLabel = "Button",
|
|
}) : super(key: key);
|
|
|
|
final Widget icon;
|
|
final VoidCallback? onPressed;
|
|
final Color? color;
|
|
// final double circularBorderRadius;
|
|
final double size;
|
|
final List<BoxShadow> shadows;
|
|
final String semanticsLabel;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: size,
|
|
width: size,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(1000),
|
|
color:
|
|
color ?? Theme.of(context).extension<StackColors>()!.background,
|
|
boxShadow: shadows,
|
|
),
|
|
child: Semantics(
|
|
excludeSemantics: true,
|
|
label: semanticsLabel,
|
|
child: MaterialButton(
|
|
splashColor: Theme.of(context).extension<StackColors>()!.highlight,
|
|
padding: EdgeInsets.zero,
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(1000),
|
|
),
|
|
onPressed: onPressed,
|
|
child: icon,
|
|
),
|
|
));
|
|
}
|
|
}
|
|
|
|
class AppBarBackButton extends StatelessWidget {
|
|
const AppBarBackButton({
|
|
Key? key,
|
|
this.onPressed,
|
|
this.isCompact = false,
|
|
this.size,
|
|
this.iconSize,
|
|
this.semanticsLabel = "Back Button. Takes Back To Previous Page.",
|
|
}) : super(key: key);
|
|
|
|
final VoidCallback? onPressed;
|
|
final bool isCompact;
|
|
final double? size;
|
|
final double? iconSize;
|
|
final String semanticsLabel;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDesktop = Util.isDesktop;
|
|
return Padding(
|
|
padding: isDesktop
|
|
? const EdgeInsets.symmetric(
|
|
vertical: 20,
|
|
horizontal: 24,
|
|
)
|
|
: const EdgeInsets.all(10),
|
|
child: AppBarIconButton(
|
|
semanticsLabel: semanticsLabel,
|
|
size: size ??
|
|
(isDesktop
|
|
? isCompact
|
|
? 42
|
|
: 56
|
|
: 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),
|
|
color:
|
|
Theme.of(context).extension<StackColors>()!.topNavIconPrimary,
|
|
),
|
|
onPressed: onPressed ?? Navigator.of(context).pop,
|
|
));
|
|
}
|
|
}
|