mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-16 01:18:50 +00:00
some little refactor
This commit is contained in:
parent
94f3128932
commit
cd457941b1
@ -13,15 +13,15 @@ class StyleSettingsPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _StyleSettingsPageState extends State<StyleSettingsPage> {
|
||||
late int _radioValue;
|
||||
late BackgroundType _radioValue;
|
||||
|
||||
void setBackgroundValue(
|
||||
BuildContext context,
|
||||
SettingsProvider provider,
|
||||
int? value,
|
||||
BackgroundType? value,
|
||||
) {
|
||||
if (value != null) {
|
||||
provider.setSelectedBackgroundType = Settings.backgoundList[value];
|
||||
provider.setSelectedBackgroundType = value;
|
||||
setState(() {
|
||||
_radioValue = value;
|
||||
});
|
||||
@ -31,29 +31,38 @@ class _StyleSettingsPageState extends State<StyleSettingsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = Provider.of<SettingsProvider>(context, listen: false);
|
||||
_radioValue = Settings.backgoundList.indexWhere(
|
||||
(element) => element == provider.getSelectedBackgroundType,
|
||||
);
|
||||
_radioValue = provider.getSelectedBackgroundType;
|
||||
|
||||
return Center(
|
||||
child: YaruSection(
|
||||
headline: const Text('Background video'),
|
||||
child: Column(
|
||||
children: [
|
||||
for (int i = 0; i < Settings.backgoundList.length; i++)
|
||||
YaruRadioListTile(
|
||||
value: i,
|
||||
groupValue: _radioValue,
|
||||
onChanged: (v) => setBackgroundValue(context, provider, v),
|
||||
toggleable: true,
|
||||
title: Text(
|
||||
Settings.getStringNameOfBackgroundType(
|
||||
Settings.backgoundList[i],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: SizedBox(
|
||||
child: YaruSection(
|
||||
headline: const Text('Background video'),
|
||||
child: Column(
|
||||
children: Settings.backgoundList
|
||||
.map(
|
||||
(b) => YaruRadioListTile(
|
||||
value: b,
|
||||
groupValue: _radioValue,
|
||||
onChanged: (v) =>
|
||||
setBackgroundValue(context, provider, v),
|
||||
toggleable: true,
|
||||
title: Text(
|
||||
Settings.getStringNameOfBackgroundType(
|
||||
b,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -32,7 +32,8 @@ class _SettingsScreenState extends State<SettingsScreen>
|
||||
return Center(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15.0),
|
||||
child: YaruTabBar(
|
||||
tabController: tabController,
|
||||
tabs: SettingsPage.tabItems(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user