144 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Dart
		
	
	
			
		
		
	
	
			144 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Dart
		
	
	
| import 'package:flutter/material.dart';
 | |
| import 'dart:io';
 | |
| import 'package:flutter/services.dart';
 | |
| import 'package:qhd_prevention/pages/my_appbar.dart';
 | |
| 
 | |
| import '../../tools/tools.dart';
 | |
| import 'mine_sign_page.dart';
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| class FirstSignPage extends StatefulWidget {
 | |
|   const FirstSignPage({super.key});
 | |
| 
 | |
| 
 | |
|   @override
 | |
|   State<FirstSignPage> createState() => _SignatureUpdatePageState();
 | |
| }
 | |
| 
 | |
| class _SignatureUpdatePageState extends State<FirstSignPage> {
 | |
|   String imagePath="";
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     return Scaffold(
 | |
|       appBar: MyAppbar(title: "更新签字信息"),
 | |
|       body:
 | |
|       Container(
 | |
|         margin: EdgeInsets.all(16),
 | |
|         child: Column(
 | |
|           crossAxisAlignment: CrossAxisAlignment.start,
 | |
|           children: [
 | |
|             Row(
 | |
|               mainAxisAlignment: MainAxisAlignment.spaceBetween,
 | |
|               children: [
 | |
|                 GestureDetector(
 | |
|                   onTap: () {
 | |
|                     pushPage(MineSignPage(), context);
 | |
|                   },
 | |
|                   child:  Text("用户",style: TextStyle(color: Colors.black,fontSize: 16)),
 | |
|                 ),
 | |
| 
 | |
|                 _buildConfirmButton(),
 | |
|               ],
 | |
|             ),
 | |
|             const SizedBox(height: 8),
 | |
| 
 | |
|             Row(
 | |
|               children: [
 | |
|                 if (imagePath.isNotEmpty)
 | |
|                   Text('签字照片:',
 | |
|                     style: TextStyle(
 | |
|                       fontSize: 14,
 | |
|                       fontWeight: FontWeight.bold,
 | |
|                       color: Colors.grey,
 | |
|                     ),
 | |
|                   ),
 | |
|                 const SizedBox(width: 15),
 | |
|                 if (imagePath.isNotEmpty)
 | |
|                   Image.file(File(imagePath),width: 230,height: 150,fit: BoxFit.cover,),
 | |
| 
 | |
|               ],
 | |
|             ),
 | |
| 
 | |
|             const SizedBox(height: 8),
 | |
|             // 确认按钮
 | |
|             // const Spacer(),
 | |
|             _buildTrueButton(),
 | |
|           ],
 | |
|         ),
 | |
|       ),
 | |
| 
 | |
| 
 | |
|     );
 | |
|   }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|   Widget _buildConfirmButton() {
 | |
|     return SizedBox(
 | |
|       width: 80,
 | |
|       height: 30,
 | |
|       child: ElevatedButton(
 | |
|         onPressed: () async {
 | |
|           final path = await Navigator.push(
 | |
|             context,
 | |
|             MaterialPageRoute(builder: (context) => MineSignPage()),
 | |
|           );
 | |
|           // 更新状态(当子页面关闭时)
 | |
|           setState(() {
 | |
|             imagePath = path ?? '';
 | |
|           });
 | |
| 
 | |
|         },
 | |
|         style: ElevatedButton.styleFrom(
 | |
|           backgroundColor: const Color(0xFF4285F4),
 | |
|           padding: const EdgeInsets.symmetric(vertical: 5),
 | |
|           shape: RoundedRectangleBorder(
 | |
|             borderRadius: BorderRadius.circular(8),
 | |
|           ),
 | |
|         ),
 | |
|         child: Text(
 | |
|           '手写签字',
 | |
|           style: TextStyle(fontSize: 12, color: Colors.white),
 | |
|         ),
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| }
 | |
| 
 | |
| 
 | |
| Widget _buildTrueButton() {
 | |
|   return Center(
 | |
| 
 | |
|     child: ElevatedButton(
 | |
|             onPressed: () {
 | |
| 
 | |
|             },
 | |
|             style: ElevatedButton.styleFrom(
 | |
|               backgroundColor: const Color(0xFF4285F4),
 | |
|               padding: const EdgeInsets.symmetric(vertical:5,horizontal: 80),
 | |
|               shape: RoundedRectangleBorder(
 | |
|                 borderRadius: BorderRadius.circular(8),
 | |
|               ),
 | |
|             ),
 | |
|             child: Text(
 | |
|               '确认',
 | |
|               style: TextStyle(fontSize: 14, color: Colors.white),
 | |
|             ),
 | |
|           ),
 | |
| 
 | |
| 
 | |
|   );
 | |
| 
 | |
| } |