flutter/lib/pages/my/setting.dart
2025-08-21 10:50:38 +08:00

71 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:loopin/styles/index.dart';
class Setting extends StatelessWidget {
const Setting({super.key});
@override
Widget build(BuildContext context) {
final List<Map<String, dynamic>> settings = [
{
'icon': Icons.person,
'title': '账号设置',
'onTap': () => Get.toNamed('/userInfo'),
},
{
'icon': Icons.notifications,
'title': '通知设置',
'onTap': () => Get.toNamed('/notifications'),
},
{
'icon': Icons.lock,
'title': '隐私',
'onTap': () => Get.toNamed('/privacy'),
},
{
'icon': Icons.info,
'title': '关于我们',
'onTap': () => Get.toNamed('/about'),
},
];
return Scaffold(
appBar: AppBar(title: const Text('设置')),
backgroundColor: Colors.grey[200],
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Card(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
color: Colors.white,
child: Column(
children: settings.map((item) {
return Column(
children: [
ListTile(
leading: Icon(item['icon'] as IconData, color: FStyle.c999),
title: Text(item['title']),
trailing: const Icon(
Icons.chevron_right,
color: FStyle.c999,
),
onTap: item['onTap'],
),
if (item != settings.last) const Divider(height: 1, indent: 16, endIndent: 16),
],
);
}).toList(),
),
),
],
),
),
);
}
}