You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.5 KiB

2 years ago
import 'package:flutter/cupertino.dart';
2 years ago
import 'package:flutter/material.dart';
2 years ago
import 'package:flutter_screenutil/flutter_screenutil.dart';
2 years ago
import 'package:new_recook/constants/styles.dart';
class RecookBackButton extends StatelessWidget {
final bool? white;
final bool? text;
final VoidCallback? onTap;
const RecookBackButton(
{Key? key, this.white = false, this.text = false, this.onTap})
: super(key: key);
const RecookBackButton.text(
{Key? key, this.white = false, this.text = true, this.onTap})
: super(key: key);
@override
Widget build(BuildContext context) {
if (Navigator.canPop(context)) {
return text??false
? MaterialButton(
2 years ago
minWidth:106.w,
2 years ago
padding: EdgeInsets.zero,
child: Text(
'取消',
overflow: TextOverflow.visible,
style: TextStyle(
2 years ago
fontSize: 28.sp,
2 years ago
color: white??false ? Colors.white : Color(0xFF333333),
),
),
onPressed: () {
onTap == null ? Navigator.maybePop(context) : onTap!();
},
)
: IconButton(
icon: Icon(
2 years ago
CupertinoIcons.chevron_back,
2 years ago
color: white??false ? Colors.white : AppColor.blackColor,
),
onPressed: () {
onTap == null ? Navigator.maybePop(context) : onTap!();
});
} else
return SizedBox();
}
}