| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- import 'package:flutter/material.dart';
- import 'package:flutter_svg/svg.dart';
- import 'package:get/get.dart';
- import '../../model.dart';
- import '../../widget/app_net_image.dart';
- import '../../styles/color_schemes.g.dart';
- class DialogChecked extends StatelessWidget {
- final VoidCallback? onConfirm;
- final String title;
- final String sn;
- final MNetImage? image;
- final String content;
- final bool isOk;
- const DialogChecked({
- super.key,
- required this.title,
- required this.sn,
- required this.isOk,
- this.onConfirm,
- this.image,
- this.content = '',
- });
- @override
- Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.fromLTRB(50, 80, 50, 80),
- child: Column(
- children: [
- Expanded(
- child: Stack(
- children: [
- SvgPicture.asset(
- 'assets/images/bk_check_point.svg',
- height: double.infinity,
- width: double.infinity,
- fit: BoxFit.fill,
- ),
- Padding(
- padding: const EdgeInsets.all(44),
- child: Column(
- children: [
- Text(
- title,
- style: context.textTheme.headlineLarge,
- ),
- Text(sn, style: context.textTheme.titleLarge,),
- isOk?const SizedBox(width: 0, height: 0)
- :Text('顺序错误,请去正确的检查点',
- style: context.textTheme.bodyLarge?.copyWith(
- color: context.theme.colorScheme.error)),
- const Divider(),
- const SizedBox(height: 12),
- ConstrainedBox(
- constraints: const BoxConstraints(
- maxHeight: 120,
- ),
- child: AppNetImage(
- netImage: image ?? MNetImage(),
- fit: BoxFit.contain),
- ),
- const SizedBox(height: 12),
- SizedBox(
- width: double.infinity,
- child: Text(
- content,
- style: context.textTheme.bodyLarge,
- ),
- ),
- ],
- )),
- isOk?
- Positioned(
- right: 30,
- bottom: 60,
- child: Transform.rotate(
- angle: -0.3,
- child: Image.asset(
- 'assets/images/ic_checked.png',
- width: 100,
- height: 40,
- fit: BoxFit.fill,
- ),
- ),
- ):const SizedBox(width: 0, height: 0)
- ],
- )),
- const SizedBox(height: 18),
- ElevatedButton(onPressed: onConfirm, child: const Text('确定'))
- ],
- ));
- }
- }
- class _Empty extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- _showDialog();
- return const Scaffold();
- }
- }
- Future<void> _showDialog() async {
- await Future.delayed(2.seconds);
- Get.dialog(const DialogChecked(
- title: '点位: 231',
- sn: "A123",
- isOk: true,
- content: '一些内容',
- ));
- }
- void main() async {
- runApp(GetMaterialApp(
- theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
- home: _Empty()));
- }
|