flutter架 构项目基础
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
/// 选择器页
|
||||
/// 点击选项后 pop 带回结果(返回值的经典用法)
|
||||
class PickerPage extends StatelessWidget {
|
||||
const PickerPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('选择性别')),
|
||||
body: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.male, color: Color(0xFF3B82F6)),
|
||||
title: const Text('男'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
// pop 带结果:第二个参数就是要返回的值
|
||||
onTap: () => Navigator.pop(context, '男'),
|
||||
),
|
||||
Divider(height: 1.h, indent: 16, endIndent: 16),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.female, color: Color(0xFFF06292)),
|
||||
title: const Text('女'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.pop(context, '女'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user