123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import '../../../funcs.dart';
- import '../../../widget/operation_button.dart';
- ///预览操作视图
- class PreviewOperationView extends StatelessWidget {
- final void Function() onSave;
- final void Function() onCancel;
- const PreviewOperationView(
- {super.key, required this.onSave, required this.onCancel});
- @override
- Widget build(BuildContext context) {
- return OrientationBuilder(builder: (ctx, orientation) {
- Alignment alignment = orientation == Orientation.landscape
- ? Alignment.centerRight
- : Alignment.bottomCenter;
- //保存按钮
- Widget buttonSave = OperationButton(
- text: getS().save,
- onTap: onSave,
- child: const Icon(
- Icons.save,
- color: Colors.white,
- ));
- //取消按钮
- Widget buttonCancel = OperationButton(
- text: getS().retakePhoto,
- onTap: onCancel,
- child: const Icon(
- Icons.close,
- color: Colors.white,
- ));
- //根据横竖屏显示在不同位置
- return Align(
- alignment: alignment,
- child: Container(
- padding: orientation == Orientation.landscape
- ? EdgeInsets.only(right: 20.w)
- : EdgeInsets.only(bottom: 52.h),
- child: orientation == Orientation.landscape
- ? Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- buttonSave,
- SizedBox(
- height: 40.h,
- ),
- buttonCancel,
- ],
- )
- : Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- buttonSave,
- SizedBox(
- width: 44.w,
- ),
- buttonCancel,
- ],
- ),
- ),
- );
- });
- }
- }
|