Implemented various new forms of CustomFormRow into SettingsView
This commit is contained in:
@@ -46,66 +46,89 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(15, 10, 10, 0),
|
padding: const EdgeInsets.fromLTRB(10, 15, 10, 10),
|
||||||
child: CupertinoListTile(
|
child: CupertinoFormSection.insetGrouped(
|
||||||
padding: EdgeInsets.zero,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
title: Text(AppLocalizations.of(context).cabo_penalty),
|
margin: EdgeInsets.zero,
|
||||||
subtitle: Text(
|
children: [
|
||||||
AppLocalizations.of(context).cabo_penalty_subtitle),
|
CustomFormRow(
|
||||||
trailing: Stepper(
|
key: _stepperKey1,
|
||||||
key: _stepperKey1,
|
prefixText: 'Cabo-Strafe',
|
||||||
initialValue: ConfigService.caboPenalty,
|
prefixIcon: CupertinoIcons.minus_square,
|
||||||
minValue: 0,
|
suffixWidget: Stepper(
|
||||||
maxValue: 50,
|
initialValue: ConfigService.caboPenalty,
|
||||||
step: 1,
|
minValue: 0,
|
||||||
onChanged: (newCaboPenalty) {
|
maxValue: 50,
|
||||||
setState(() {
|
step: 1,
|
||||||
ConfigService.setCaboPenalty(newCaboPenalty);
|
onChanged: (newCaboPenalty) {
|
||||||
ConfigService.caboPenalty = newCaboPenalty;
|
setState(() {
|
||||||
});
|
ConfigService.setCaboPenalty(newCaboPenalty);
|
||||||
},
|
ConfigService.caboPenalty = newCaboPenalty;
|
||||||
),
|
});
|
||||||
)),
|
},
|
||||||
Padding(
|
),
|
||||||
padding: const EdgeInsets.fromLTRB(15, 10, 10, 0),
|
),
|
||||||
child: CupertinoListTile(
|
CustomFormRow(
|
||||||
padding: EdgeInsets.zero,
|
key: _stepperKey2,
|
||||||
title: Text(AppLocalizations.of(context).point_limit),
|
prefixText: 'Punkte-Limit',
|
||||||
subtitle:
|
prefixIcon: FontAwesomeIcons.bullseye,
|
||||||
Text(AppLocalizations.of(context).point_limit_subtitle),
|
suffixWidget: Stepper(
|
||||||
trailing: Stepper(
|
initialValue: ConfigService.pointLimit,
|
||||||
key: _stepperKey2,
|
minValue: 30,
|
||||||
initialValue: ConfigService.pointLimit,
|
maxValue: 1000,
|
||||||
minValue: 30,
|
step: 10,
|
||||||
maxValue: 1000,
|
onChanged: (newPointLimit) {
|
||||||
step: 10,
|
setState(() {
|
||||||
onChanged: (newPointLimit) {
|
ConfigService.setPointLimit(newPointLimit);
|
||||||
setState(() {
|
ConfigService.pointLimit = newPointLimit;
|
||||||
ConfigService.setPointLimit(newPointLimit);
|
});
|
||||||
ConfigService.pointLimit = newPointLimit;
|
},
|
||||||
});
|
),
|
||||||
},
|
),
|
||||||
),
|
CustomFormRow(
|
||||||
)),
|
prefixText:
|
||||||
Padding(
|
AppLocalizations.of(context).reset_to_default,
|
||||||
padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
|
prefixIcon: CupertinoIcons.arrow_counterclockwise,
|
||||||
child: Center(
|
onPressed: () {
|
||||||
heightFactor: 0.9,
|
ConfigService.resetConfig();
|
||||||
child: CupertinoButton(
|
setState(() {
|
||||||
padding: EdgeInsets.zero,
|
_stepperKey1 = UniqueKey();
|
||||||
onPressed: () => setState(() {
|
_stepperKey2 = UniqueKey();
|
||||||
ConfigService.resetConfig();
|
print('Config reset to default');
|
||||||
_stepperKey1 = UniqueKey();
|
});
|
||||||
_stepperKey2 = UniqueKey();
|
},
|
||||||
}),
|
)
|
||||||
child:
|
])),
|
||||||
Text(AppLocalizations.of(context).reset_to_default),
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0),
|
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context).game_data,
|
AppLocalizations.of(context).data,
|
||||||
|
style: CustomTheme.rowTitle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 15, 10, 10),
|
||||||
|
child: CupertinoFormSection.insetGrouped(
|
||||||
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
children: [
|
||||||
|
CustomFormRow(
|
||||||
|
prefixText: AppLocalizations.of(context).import_data,
|
||||||
|
prefixIcon: CupertinoIcons.square_arrow_down,
|
||||||
|
onPressed: () => LocalStorageService.importJsonFile(),
|
||||||
|
suffixWidget: const CupertinoListTileChevron(),
|
||||||
|
),
|
||||||
|
CustomFormRow(
|
||||||
|
prefixText: AppLocalizations.of(context).export_data,
|
||||||
|
prefixIcon: CupertinoIcons.square_arrow_up,
|
||||||
|
onPressed: () => LocalStorageService.importJsonFile(),
|
||||||
|
suffixWidget: const CupertinoListTileChevron(),
|
||||||
|
),
|
||||||
|
])),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0),
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context).app,
|
||||||
style: CustomTheme.rowTitle,
|
style: CustomTheme.rowTitle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -115,54 +138,73 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
children: [
|
children: [
|
||||||
CustomFormRow(
|
|
||||||
prefixText: 'Spieldaten importieren',
|
|
||||||
prefixIcon: CupertinoIcons.square_arrow_down,
|
|
||||||
onTap: () {},
|
|
||||||
suffixWidget: CupertinoListTileChevron(),
|
|
||||||
),
|
|
||||||
CustomFormRow(
|
|
||||||
prefixText: 'Spieldaten exportieren',
|
|
||||||
prefixIcon: CupertinoIcons.square_arrow_up,
|
|
||||||
onTap: () {},
|
|
||||||
suffixWidget: const CupertinoListTileChevron(),
|
|
||||||
),
|
|
||||||
CustomFormRow(
|
CustomFormRow(
|
||||||
prefixText: AppLocalizations.of(context).create_issue,
|
prefixText: AppLocalizations.of(context).create_issue,
|
||||||
prefixIcon: FontAwesomeIcons.github,
|
prefixIcon: FontAwesomeIcons.github,
|
||||||
onTap: () => launchUrl(Uri.parse(
|
onPressed: () => launchUrl(Uri.parse(
|
||||||
'https://github.com/flixcoo/Cabo-Counter/issues')),
|
'https://github.com/flixcoo/Cabo-Counter/issues')),
|
||||||
suffixWidget: const CupertinoListTileChevron(),
|
suffixWidget: const CupertinoListTileChevron(),
|
||||||
),
|
),
|
||||||
|
CustomFormRow(
|
||||||
|
prefixText: 'App-Version',
|
||||||
|
prefixIcon: CupertinoIcons.info,
|
||||||
|
onPressed: null,
|
||||||
|
suffixWidget: FutureBuilder<PackageInfo>(
|
||||||
|
future: _getPackageInfo(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
return Text(
|
||||||
|
'${Globals.appDevPhase} ${snapshot.data!.version} ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: CustomTheme.primaryColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text(
|
||||||
|
'${AppLocalizations.of(context).app_version} -.-.-',
|
||||||
|
style: TextStyle(
|
||||||
|
color: CustomTheme.primaryColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Text(
|
||||||
|
AppLocalizations.of(context).loading,
|
||||||
|
style: TextStyle(
|
||||||
|
color: CustomTheme.primaryColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
CustomFormRow(
|
||||||
|
prefixText: 'Build-Nr.',
|
||||||
|
prefixIcon: CupertinoIcons.info,
|
||||||
|
onPressed: null,
|
||||||
|
suffixWidget: FutureBuilder<PackageInfo>(
|
||||||
|
future: _getPackageInfo(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
return Text(
|
||||||
|
snapshot.data!.buildNumber,
|
||||||
|
style: TextStyle(
|
||||||
|
color: CustomTheme.primaryColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text(
|
||||||
|
'-',
|
||||||
|
style: TextStyle(
|
||||||
|
color: CustomTheme.primaryColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Text(
|
||||||
|
AppLocalizations.of(context).loading,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)),
|
||||||
])),
|
])),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Positioned(
|
|
||||||
bottom: 30,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Center(
|
|
||||||
child: FutureBuilder<PackageInfo>(
|
|
||||||
future: _getPackageInfo(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.hasData) {
|
|
||||||
return Text(
|
|
||||||
'${Globals.appDevPhase} ${snapshot.data!.version} '
|
|
||||||
'(${AppLocalizations.of(context).build} ${snapshot.data!.buildNumber})',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
);
|
|
||||||
} else if (snapshot.hasError) {
|
|
||||||
return Text(
|
|
||||||
'${AppLocalizations.of(context).app_version} -.-.- (${AppLocalizations.of(context).build} -)',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Text(
|
|
||||||
AppLocalizations.of(context).load_version,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
))),
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: cabo_counter
|
|||||||
description: "Mobile app for the card game Cabo"
|
description: "Mobile app for the card game Cabo"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.3.9+337
|
version: 0.4.0+371
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user