2022-06-16 20:30:02 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2022-07-31 17:59:25 +00:00
|
|
|
import 'package:localization/localization.dart';
|
|
|
|
import './account.dart' as account;
|
2022-08-06 10:13:00 +00:00
|
|
|
import './about.dart' as about;
|
2022-08-10 16:47:34 +00:00
|
|
|
import './app.dart' as app;
|
2022-09-30 18:06:24 +00:00
|
|
|
import 'package:loris/global.dart' as global;
|
|
|
|
import 'package:loris/themes/themes.dart' as themes;
|
2022-06-16 20:30:02 +00:00
|
|
|
|
2022-07-02 22:03:10 +00:00
|
|
|
Widget settings(context) {
|
2022-07-31 17:59:25 +00:00
|
|
|
final List<Widget> categories = [
|
|
|
|
SettingsPanel(
|
|
|
|
title: "account-settings".i18n(),
|
|
|
|
content: const account.AccountSettings()),
|
2022-08-10 16:47:34 +00:00
|
|
|
SettingsPanel(
|
|
|
|
title: "app-settings".i18n(), content: const app.AppSettings()),
|
2022-08-06 10:13:00 +00:00
|
|
|
SettingsPanel(
|
|
|
|
title: "about".i18n(),
|
|
|
|
content: const about.AboutSettings(),
|
|
|
|
)
|
2022-07-30 15:28:29 +00:00
|
|
|
];
|
2022-09-30 18:31:08 +00:00
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: ListView.separated(
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return categories[index];
|
|
|
|
},
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
return const Divider(
|
|
|
|
height: 0,
|
|
|
|
color: Colors.transparent,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: categories.length),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
2022-10-01 10:34:10 +00:00
|
|
|
border: Border(
|
|
|
|
top: BorderSide(
|
|
|
|
color: Theme.of(context).colorScheme.primary,
|
|
|
|
width: 2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Material(
|
|
|
|
child: Wrap(
|
|
|
|
alignment: WrapAlignment.center,
|
2022-10-01 11:41:18 +00:00
|
|
|
children: const [],
|
2022-10-01 10:34:10 +00:00
|
|
|
),
|
2022-09-30 18:31:08 +00:00
|
|
|
)),
|
|
|
|
],
|
|
|
|
);
|
2022-07-30 15:28:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class SettingsPanel extends StatelessWidget {
|
|
|
|
const SettingsPanel({
|
|
|
|
Key? key,
|
|
|
|
required this.title,
|
2022-07-31 17:59:25 +00:00
|
|
|
required this.content,
|
2022-07-30 15:28:29 +00:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final String title;
|
2022-07-31 17:59:25 +00:00
|
|
|
final Widget content;
|
2022-07-30 15:28:29 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-08-14 18:02:42 +00:00
|
|
|
return Padding(
|
2022-09-30 18:06:24 +00:00
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: themes.defaultSeperatorHeight * 2,
|
|
|
|
vertical: themes.defaultSeperatorHeight),
|
2022-08-14 18:02:42 +00:00
|
|
|
child: Container(
|
2022-09-30 18:06:24 +00:00
|
|
|
constraints: global.getConstraints(context),
|
2022-08-14 18:02:42 +00:00
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context).colorScheme.surface,
|
2022-09-11 20:29:41 +00:00
|
|
|
border: Border.all(
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
width: 2,
|
|
|
|
),
|
2022-08-14 18:02:42 +00:00
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
),
|
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2022-09-30 18:06:24 +00:00
|
|
|
SelectableText(
|
2022-08-14 18:02:42 +00:00
|
|
|
title,
|
2022-09-30 18:06:24 +00:00
|
|
|
style: Theme.of(context).textTheme.displayMedium,
|
2022-08-14 18:02:42 +00:00
|
|
|
),
|
|
|
|
content,
|
|
|
|
],
|
|
|
|
),
|
2022-07-30 15:28:29 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2022-06-16 20:30:02 +00:00
|
|
|
}
|