stack_wallet/lib/widgets/custom_buttons/app_bar_icon_button.dart

81 lines
2.1 KiB
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/cfcolors.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 [],
}) : 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),
color: color ?? CFColors.white,
boxShadow: shadows,
),
child: MaterialButton(
splashColor: CFColors.splashLight,
padding: EdgeInsets.zero,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(1000),
),
onPressed: onPressed,
child: icon,
),
);
}
}
class AppBarBackButton extends StatelessWidget {
const AppBarBackButton({Key? key, required this.onPressed}) : super(key: key);
final VoidCallback onPressed;
@override
Widget build(BuildContext context) {
final isDesktop =
Platform.isMacOS || Platform.isWindows || Platform.isLinux;
return Padding(
padding: isDesktop
? const EdgeInsets.symmetric(
vertical: 20,
horizontal: 24,
)
: const EdgeInsets.all(10),
child: AppBarIconButton(
size: isDesktop ? 56 : 32,
color: isDesktop
? CFColors.textFieldDefaultBackground
: CFColors.almostWhite,
shadows: const [],
icon: SvgPicture.asset(
Assets.svg.arrowLeft,
width: 24,
height: 24,
),
onPressed: onPressed,
),
);
}
}