mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2026-03-21 21:58:52 +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> {
|
class _StyleSettingsPageState extends State<StyleSettingsPage> {
|
||||||
late int _radioValue;
|
late BackgroundType _radioValue;
|
||||||
|
|
||||||
void setBackgroundValue(
|
void setBackgroundValue(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
SettingsProvider provider,
|
SettingsProvider provider,
|
||||||
int? value,
|
BackgroundType? value,
|
||||||
) {
|
) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
provider.setSelectedBackgroundType = Settings.backgoundList[value];
|
provider.setSelectedBackgroundType = value;
|
||||||
setState(() {
|
setState(() {
|
||||||
_radioValue = value;
|
_radioValue = value;
|
||||||
});
|
});
|
||||||
@ -31,29 +31,38 @@ class _StyleSettingsPageState extends State<StyleSettingsPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final provider = Provider.of<SettingsProvider>(context, listen: false);
|
final provider = Provider.of<SettingsProvider>(context, listen: false);
|
||||||
_radioValue = Settings.backgoundList.indexWhere(
|
_radioValue = provider.getSelectedBackgroundType;
|
||||||
(element) => element == provider.getSelectedBackgroundType,
|
|
||||||
);
|
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: YaruSection(
|
child: Column(
|
||||||
headline: const Text('Background video'),
|
children: [
|
||||||
child: Column(
|
Padding(
|
||||||
children: [
|
padding: const EdgeInsets.all(15.0),
|
||||||
for (int i = 0; i < Settings.backgoundList.length; i++)
|
child: SizedBox(
|
||||||
YaruRadioListTile(
|
child: YaruSection(
|
||||||
value: i,
|
headline: const Text('Background video'),
|
||||||
groupValue: _radioValue,
|
child: Column(
|
||||||
onChanged: (v) => setBackgroundValue(context, provider, v),
|
children: Settings.backgoundList
|
||||||
toggleable: true,
|
.map(
|
||||||
title: Text(
|
(b) => YaruRadioListTile(
|
||||||
Settings.getStringNameOfBackgroundType(
|
value: b,
|
||||||
Settings.backgoundList[i],
|
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(
|
return Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 15.0),
|
||||||
child: YaruTabBar(
|
child: YaruTabBar(
|
||||||
tabController: tabController,
|
tabController: tabController,
|
||||||
tabs: SettingsPage.tabItems(),
|
tabs: SettingsPage.tabItems(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user