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.
ansu_ui/lib/pickers/as_picker_box.dart

82 lines
2.2 KiB

import 'package:ansu_ui/divider/as_divider.dart';
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASPickerBox extends StatelessWidget {
final VoidCallback onPressed;
final String confirmString;
final String title;
final Widget child;
const ASPickerBox(
{Key key,
this.onPressed,
this.confirmString = '完成',
this.title,
@required this.child})
: super(key: key);
_buildButton({
@required String title,
@required VoidCallback onPressed,
}) {
return TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(kPrimaryColor),
overlayColor: MaterialStateProperty.all(kPrimaryColor.withOpacity(0.2)),
padding:
MaterialStateProperty.all(EdgeInsets.symmetric(horizontal: 20.w)),
textStyle: MaterialStateProperty.all(TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w500,
)),
),
onPressed: onPressed,
child: Text(title),
);
}
@override
Widget build(BuildContext context) {
return Material(
color: kForegroundColor,
child: SizedBox(
height: 260.w,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 48.w,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_buildButton(
title: '取消',
onPressed: () {
Navigator.pop(context);
}),
Expanded(
child: Center(
child: Text(
title ?? '',
style: TextStyle(
color: kTextColor,
fontSize: 16.sp,
),
),
),
),
_buildButton(title: confirmString, onPressed: onPressed),
],
),
),
ASDivider(),
Expanded(child: child),
],
),
),
);
}
}