-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"appName": "Paas Dashboard", | ||
"refresh": "Refresh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"appName": "Paas 仪表盘", | ||
"refresh": "刷新" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import 'dart:developer'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:paas_dashboard_flutter/vm/general/settings_view_model.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class SettingsScreen extends StatefulWidget { | ||
SettingsScreen(); | ||
|
||
@override | ||
State<StatefulWidget> createState() { | ||
return new SettingsScreenState(); | ||
} | ||
} | ||
|
||
class SettingsScreenState extends State<SettingsScreen> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final vm = Provider.of<SettingsViewModel>(context); | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Settings'), | ||
), | ||
body: ExpansionTile( | ||
title: Text('Change language'), | ||
leading: Icon(Icons.language), | ||
initiallyExpanded: false, | ||
children: [ | ||
RadioListTile( | ||
title: Text('English'), | ||
value: 'en', | ||
groupValue: vm.language, | ||
onChanged: _changed), | ||
RadioListTile( | ||
title: Text('汉语'), | ||
value: 'zh', | ||
groupValue: vm.language, | ||
onChanged: _changed), | ||
], | ||
), | ||
); | ||
} | ||
|
||
void _changed(value) { | ||
if (value != null) { | ||
log('change language to $value'); | ||
final vm = Provider.of<SettingsViewModel>(context, listen: false); | ||
if (value != null) { | ||
vm.setLan(value); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class SettingsViewModel extends ChangeNotifier { | ||
String language = 'en'; | ||
|
||
void setLan(String lan) { | ||
this.language = lan; | ||
notifyListeners(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters