123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- // ignore_for_file: must_be_immutable
- import 'package:flutter/material.dart';
- import 'package:flutter/widgets.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- import 'package:cs_resources/constants/color_constants.dart';
- import '../my_text_view.dart';
- /// 相机相册的选择
- class AlbumDefaultSelectDialog extends StatelessWidget {
- bool isTypeVideo = false;
- VoidCallback? cancelAction;
- VoidCallback cameraAction;
- VoidCallback albumAction;
- AlbumDefaultSelectDialog({
- Key? key,
- required this.cameraAction,
- required this.albumAction,
- this.cancelAction,
- this.isTypeVideo = false,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- final bgColor = const Color(0xFAFFFFFF);
- const roundRadios = 10.0;
- return Container(
- margin: const EdgeInsets.only(left: 30, right: 30, bottom: 30),
- child: Column(
- //顶部标题
- mainAxisSize: MainAxisSize.min,
- children: [
- // 顶部的文本
- Container(
- width: double.infinity,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: bgColor,
- borderRadius: const BorderRadius.only(
- topLeft: Radius.circular(roundRadios),
- topRight: Radius.circular(roundRadios),
- )),
- child: MyTextView(
- isTypeVideo ? "选择视频" : "选择图片",
- paddingTop: 10,
- paddingBottom: 10,
- textColor: const Color(0xff323843),
- fontSize: 12,
- isFontRegular: true,
- ),
- ),
- // 分割线
- Container(
- color: ColorConstants.dividerItem,
- height: 0.5,
- ),
- InkWell(
- onTap: () {
- onCancel();
- cameraAction.call();
- },
- child: Container(
- width: double.infinity,
- alignment: Alignment.center,
- color: bgColor,
- child: MyTextView(
- "相机",
- textColor: ColorConstants.blue1578fe,
- paddingTop: 15,
- paddingBottom: 15,
- fontSize: 16,
- isFontMedium: true,
- ),
- ),
- ),
- // 分割线
- Container(
- color: ColorConstants.dividerItem,
- height: 0.5,
- ),
- InkWell(
- onTap: () {
- onCancel();
- albumAction.call();
- },
- child: Container(
- width: double.infinity,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: bgColor,
- borderRadius: const BorderRadius.only(
- bottomRight: Radius.circular(roundRadios),
- bottomLeft: Radius.circular(roundRadios),
- )),
- child: MyTextView(
- "相册",
- textColor: ColorConstants.blue1578fe,
- fontSize: 16,
- paddingTop: 15,
- paddingBottom: 15,
- isFontMedium: true,
- ),
- ),
- ),
- // 分割线
- Container(
- color: ColorConstants.dividerA6,
- height: 0.5,
- ),
- // 取消按钮
- InkWell(
- onTap: () {
- onCancel();
- cancelAction?.call();
- },
- child: Container(
- margin: const EdgeInsets.only(top: 10),
- width: double.infinity,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: bgColor,
- borderRadius: const BorderRadius.all(Radius.circular(roundRadios))),
- child: MyTextView(
- "取消",
- textColor: ColorConstants.blue1578fe,
- fontSize: 16,
- paddingTop: 15,
- paddingBottom: 15,
- isFontMedium: true,
- ),
- ),
- ),
- ],
- ),
- );
- }
- //取消弹框
- void onCancel() async {
- SmartDialog.dismiss();
- }
- }
|