Commit 36850223 authored by Nicolas Richard Walter Boeckh's avatar Nicolas Richard Walter Boeckh 💬

Begin uniformity run, necessity of size dependent themes.

Added:
- Slight doc

Modified:
- Various to `Theme.of(context)` to have constant themes, need to make screen size dependent.
- Initial dialog to not out of bounds
- Map pane to flex to/from
- Moved HomeController in hierarchy, now stays active through state changes.
parent cf419147
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"app_settings","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\app_settings-4.0.3\\\\","dependencies":[]},{"name":"connectivity","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity-0.4.9+2\\\\","dependencies":[]},{"name":"flutter_blue","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_blue-0.7.2\\\\","dependencies":[]},{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.2.1\\\\","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_api_availability-2.0.2\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.4+1\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-4.2.0+hotfix.3\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.7+2\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"android":[{"name":"app_settings","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\app_settings-4.0.3\\\\","dependencies":[]},{"name":"connectivity","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity-0.4.9+2\\\\","dependencies":[]},{"name":"flutter_blue","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_blue-0.7.2\\\\","dependencies":[]},{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.2.1\\\\","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_api_availability-2.0.2\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.4+1\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-4.2.0+hotfix.3\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.7+2\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_macos-0.1.0+4\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+8\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"connectivity_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_for_web-0.3.1+2\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+5\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"app_settings","dependencies":[]},{"name":"connectivity","dependencies":["connectivity_macos","connectivity_for_web"]},{"name":"connectivity_for_web","dependencies":[]},{"name":"connectivity_macos","dependencies":[]},{"name":"flutter_blue","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-09-14 03:13:52.288184","version":"1.21.0-10.0.pre.193"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"app_settings","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\app_settings-4.0.3\\\\","dependencies":[]},{"name":"connectivity","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity-0.4.9+2\\\\","dependencies":[]},{"name":"flutter_blue","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_blue-0.7.2\\\\","dependencies":[]},{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.2.1\\\\","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_api_availability-2.0.2\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.4+1\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-4.2.0+hotfix.3\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.7+2\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"android":[{"name":"app_settings","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\app_settings-4.0.3\\\\","dependencies":[]},{"name":"connectivity","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity-0.4.9+2\\\\","dependencies":[]},{"name":"flutter_blue","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_blue-0.7.2\\\\","dependencies":[]},{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.2.1\\\\","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_api_availability-2.0.2\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.4+1\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-4.2.0+hotfix.3\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.7+2\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_macos-0.1.0+4\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+8\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.2.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"connectivity_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_for_web-0.3.1+2\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+5\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"app_settings","dependencies":[]},{"name":"connectivity","dependencies":["connectivity_macos","connectivity_for_web"]},{"name":"connectivity_for_web","dependencies":[]},{"name":"connectivity_macos","dependencies":[]},{"name":"flutter_blue","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-09-15 01:11:45.966049","version":"1.21.0-10.0.pre.193"}
\ No newline at end of file
......@@ -42,6 +42,7 @@ class HomeController {
/// Forces the [CircularBottomNavigation] to the correct position.
set navbar(int page) {
this._currentPage = page;
// Set to false to mitigate livelock.
this._triggerOriginNavbar = false;
......
......@@ -64,7 +64,7 @@ class DataHeader {
Stream<String> deviceIdStream() async* {
while(true) {
yield this._deviceId;
yield this._deviceId ?? '';
await Future.delayed(Duration(seconds: 1));
}
}
......
......@@ -22,19 +22,29 @@ class BluetoothDialog extends StatefulWidget {
}
// TODO Doc
/// Represents a state of the [BluetoothDialog] [Widget], which is updated by the current availability of Bluetooth on the target device.
class _BluetoothDialogState extends State<BluetoothDialog> {
_BluetoothDialogState({Key key});
/// Listenable as to whether Bluetooth is usable on this device.
BehaviorSubject<bool> _bluetoothUsable = BehaviorSubject<bool>();
/// Whether bluetooth is available on the device.
bool _bluetoothAvailable = false;
/// Whether the widget has checked if bluetooth was available on this device.
bool _bluetoothAvailabilityChecked = false;
/// Whether the app is currently showing the bluetooth unusable dialog.
bool _showingDialog = false;
/// The current state of the Bluetooth adapter.
BluetoothState _state = BluetoothState.off;
/// The list of devices frequently used.
List<Device> _frequentDevices;
/// A key for the Scaffold state, so as to avoid reloading the widget unnecessarily.
GlobalKey<ScaffoldState> _key = GlobalKey();
@override
......@@ -42,7 +52,7 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
super.initState();
if (!this._bluetoothAvailabilityChecked) {
print('Checking BTAvail');
// Check whether the bluetooth adapter is available on this device.
BTLEHandler().fblueInstance.isAvailable.then(
(bool value) => setState(() {
this._bluetoothAvailabilityChecked = true;
......@@ -52,7 +62,7 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
);
}
// Check the initial bluetooth state.
BTLEHandler().fblueInstance.state.first.then(
(newState) {
setState(() {
......@@ -62,6 +72,7 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
}
);
// Listen to changes in bluetooth adapter state and set the widget state accordingly
BTLEHandler().fblueInstance.state.listen((BluetoothState newState) {
if (mounted && _state != newState) {
this._bluetoothUsable.value = this._bluetoothAvailable && (newState != BluetoothState.off);
......@@ -70,7 +81,6 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
});
}
});
}
@override
......@@ -79,6 +89,7 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
super.dispose();
}
Widget _buildSubZoneTitle({@required String text}) =>
Container(
width: double.maxFinite,
......@@ -96,10 +107,9 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
),
child: Text(
text,
style: TextStyle(
fontSize: 20,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: Colors.white
),
)
),
);
......@@ -122,8 +132,8 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
title: Text(
AppLocalization.of(context).bluetoothScanMessage,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22
style: Theme.of(context).textTheme.subtitle2.copyWith(
color: Colors.white
)
),
actions: [
......@@ -143,9 +153,7 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
)
],
),
body: RefreshIndicator(
onRefresh: () async {
if (this._bluetoothUsable.value) {
if (await BTLEHandler().fblueInstance.isScanning.first)
......@@ -214,7 +222,6 @@ class _BluetoothDialogState extends State<BluetoothDialog> {
),
Divider(indent: 20, endIndent: 20, color: Colors.grey[600], thickness: 1,),
_buildSubZoneTitle(text: AppLocalization.of(context).bluetoothAvailable),
StreamBuilder<List<ScanResult>>(
stream: BTLEHandler().fblueInstance.scanResults.transform(
new StreamTransformer.fromHandlers(
......
......@@ -37,15 +37,18 @@ class DataWidget extends StatelessWidget {
child: Text(
'Locations of Interest',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22
style: Theme.of(context).textTheme.headline6.copyWith(
//fontSize: 22
),
),
),
IconButton(
// Open other (Scaffold + Form) with nominatim etc + adds to DB.
onPressed: () => {},
icon: Icon(Icons.add),
icon: Icon(
Icons.add,
size: Theme.of(context).iconTheme.size
),
)
],
),
......
......@@ -89,9 +89,8 @@ class _GraphState extends State<Graph> {
bottomTitles: SideTitles(
showTitles: true,
reservedSize: 22,
textStyle: const TextStyle(
textStyle: Theme.of(context).textTheme.caption.copyWith(
color: Color(0xff72719b),
fontSize: 12,
),
margin: 15,
rotateAngle: -30,
......
......@@ -38,7 +38,10 @@ class Indicator extends StatelessWidget {
),
Text(
text,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: textColor),
style: Theme.of(context).textTheme.bodyText1.copyWith(
fontWeight: FontWeight.bold,
color: textColor
),
)
],
)
......
......@@ -97,16 +97,15 @@ class _DataTileState extends State<DataTile> {
children: [
Text(
pmSymbol.key,
style: TextStyle(
fontSize: 19,
style: Theme.of(context).textTheme.subtitle2.copyWith(
fontWeight: FontWeight.w300,
color: (value != -1 && value != null) ? Colors.black : Colors.grey[500]
),
),
SizedBox(height: 4),
Text(
valueRepresentation,
style: TextStyle(
fontSize: 17,
style: Theme.of(context).textTheme.subtitle1.copyWith(
fontWeight: FontWeight.bold
),
)
......@@ -136,23 +135,23 @@ class _DataTileState extends State<DataTile> {
children: [
Text(
title,
style: TextStyle(
fontSize: 20,
style: Theme.of(context).textTheme.subtitle2.copyWith(
//fontSize: 20,
color: (value != -1 && value != null) ? Colors.black : Colors.grey[500]
),
),
Text(
unit,
style: TextStyle(
fontSize: 14,
style: Theme.of(context).textTheme.caption.copyWith(
//fontSize: 14,
color: (value != -1 && value != null) ? Colors.black : Colors.grey[500]
),
),
SizedBox(height: 8),
Text(
valueRepresentation,
style: TextStyle(
fontSize: 18,
style: Theme.of(context).textTheme.subtitle2.copyWith(
//fontSize: 18,
fontWeight: FontWeight.bold
),
)
......@@ -204,8 +203,7 @@ class _DataTileState extends State<DataTile> {
child: Text(
'${this.locationName}',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 20,
style: Theme.of(context).textTheme.headline6.copyWith(
fontWeight: FontWeight.bold
)
)
......
......@@ -8,7 +8,7 @@ import 'package:logair_application/utils/decorations.dart';
import 'package:logair_application/utils/enums/preference_keys.dart';
import 'package:rxdart/subjects.dart';
Widget _buildDialogButton({@required String label, @required BoxDecoration decoration, @required EdgeInsets margin, @required Function action}) {
Widget _buildDialogButton({@required BuildContext context, @required String label, @required BoxDecoration decoration, @required EdgeInsets margin, @required Function action}) {
return GestureDetector(
onTap: () => action(),
child: Container(
......@@ -18,9 +18,7 @@ Widget _buildDialogButton({@required String label, @required BoxDecoration decor
child: Text(
label,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18
),
style: Theme.of(context).textTheme.button
),
),
);
......@@ -67,127 +65,135 @@ dynamic showInitialDialog({@required BuildContext context}) {
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline4,
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'The following settings require your immediate attention :',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 16),
),
Divider(thickness: 0, indent: 20, endIndent: 20, height: 5,),
StreamBuilder<bool>(
stream: _displayError.stream,
initialData: false,
builder: (context, snapshot) {
if (snapshot.data) {
return Text(
'Both settings need to be set',
style: Theme.of(context).textTheme.subtitle1.copyWith(color: Colors.red)
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'The following settings require your immediate attention.',
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.subtitle1,
),
Text(
'You can modify them at any time in the Preferences page.',
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.subtitle1.copyWith(fontStyle: FontStyle.italic),
),
Divider(thickness: 0, indent: 20, endIndent: 20, height: 5,),
StreamBuilder<bool>(
stream: _displayError.stream,
initialData: false,
builder: (context, snapshot) {
if (snapshot.data) {
return Text(
'Both settings need to be set',
style: Theme.of(context).textTheme.subtitle1.copyWith(color: Colors.red)
);
} else {
return SizedBox();
}
},
),
Divider(color: Colors.grey[600], indent: 20, endIndent: 20, height: 20,),
StreamBuilder<bool>(
stream: _displayError1.stream,
initialData: false,
builder: (context, snapshot) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey[300],
border: Border.all(color: (snapshot.data) ? Colors.red : Colors.transparent)
),
child: Column(
children: [
Text(
'Share data with LogAir servers',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 16),
),
Divider(thickness: 0, indent: 20, endIndent: 20, height: 10,),
Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 3),
child: TristateToggleWidget(
observable: _shareToggleObservable,
)
),
],
),
);
} else {
return SizedBox();
}
},
),
Divider(color: Colors.grey[600], indent: 20, endIndent: 20, height: 20,),
StreamBuilder<bool>(
stream: _displayError1.stream,
initialData: false,
builder: (context, snapshot) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey[300],
border: Border.all(color: (snapshot.data) ? Colors.red : Colors.transparent)
),
child: Column(
children: [
Text(
'Share data with LogAir servers',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 16),
),
Divider(thickness: 0, indent: 20, endIndent: 20, height: 10,),
Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 3),
child: TristateToggleWidget(
observable: _shareToggleObservable,
)
),
],
),
);
},
},
),
Divider(color: Colors.grey[600], indent: 20, endIndent: 20, height: 20,),
StreamBuilder<bool>(
stream: _displayError2.stream,
initialData: false,
builder: (context, snapshot) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey[300],
border: Border.all(color: (snapshot.data) ? Colors.red : Colors.transparent)
),
child: Column(
children: [
Text(
'Use 3G/4G/5G networks to send and receive application data',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 16),
),
Divider(thickness: 0, indent: 20, endIndent: 20, height: 10,),
Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 3),
child: TristateToggleWidget(
observable: _3gToggleObservable,
)
),
],
),
Divider(color: Colors.grey[600], indent: 20, endIndent: 20, height: 20,),
StreamBuilder<bool>(
stream: _displayError2.stream,
initialData: false,
builder: (context, snapshot) {
return Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey[300],
border: Border.all(color: (snapshot.data) ? Colors.red : Colors.transparent)
),
child: Column(
children: [
Text(
'Use 3G/4G/5G networks to send and receive application data',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline6.copyWith(fontSize: 16),
),
Divider(thickness: 0, indent: 20, endIndent: 20, height: 10,),
Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 3),
child: TristateToggleWidget(
observable: _3gToggleObservable,
)
),
],
),
);
}
),
Divider(height: 30,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: SizedBox(),
),
);
}
),
Divider(height: 30,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: SizedBox(),
),
Expanded(
child: _buildDialogButton(
label: 'Confirm',
decoration: containerNeumorphicDecoration,
margin: EdgeInsets.only(left: 5),
action: () async {
int _wantsToShare = _shareToggleObservable.value;
int _wantsTo3g = _3gToggleObservable.value;
Expanded(
child: _buildDialogButton(
context: context,
label: 'Confirm',
decoration: containerNeumorphicDecoration,
margin: EdgeInsets.only(left: 5),
action: () async {
int _wantsToShare = _shareToggleObservable.value;
int _wantsTo3g = _3gToggleObservable.value;
_displayError1.value = _wantsToShare == 0;
_displayError2.value = _wantsTo3g == 0;
_displayError1.value = _wantsToShare == 0;
_displayError2.value = _wantsTo3g == 0;
if (_wantsToShare == 0 || _wantsTo3g == 0) {
return;
}
await PreferencesHandler().setPreferencesBool(PreferenceKeys.GEN__SHARE.key, _wantsToShare == 1);
await PreferencesHandler().setPreferencesBool(PreferenceKeys.NET__USE_MOBILE_NET.key, _wantsTo3g == 1);
Navigator.of(context).pop(true);
},
if (_wantsToShare == 0 || _wantsTo3g == 0) {
return;
}
await PreferencesHandler().setPreferencesBool(PreferenceKeys.GEN__SHARE.key, _wantsToShare == 1);
await PreferencesHandler().setPreferencesBool(PreferenceKeys.NET__USE_MOBILE_NET.key, _wantsTo3g == 1);
Navigator.of(context).pop(true);
},
),
),
),
]
)
],
]
)
],
),
),
),
......
......@@ -49,7 +49,10 @@ class MapContainer extends BaseWidget {
Expanded(
child: RaisedButton(
onPressed: onPressed,
child: Text(text)
child: Text(
text,
style: Theme.of(context).textTheme.caption
)
),
);
......@@ -72,12 +75,15 @@ class MapContainer extends BaseWidget {
flex: 4,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
height: sizingInformation.unnotchedHeight * 33/40 * 0.16,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextField(
enabled: false,
controller: _fromController,
decoration: InputDecoration(
isDense: true,
labelText: 'From...',
contentPadding: EdgeInsets.zero,
),
......@@ -85,7 +91,9 @@ class MapContainer extends BaseWidget {
TextField(
enabled: false,
controller: _toController,
decoration: InputDecoration(
isDense: true,
labelText: 'To...',
contentPadding: EdgeInsets.zero,
),
......
......@@ -45,7 +45,7 @@ class OverviewNavigationButton extends StatelessWidget {
flex: 2,
child: Icon(
this.icon,
size: 30,
size: IconTheme.of(context).size
),
),
Expanded(
......@@ -53,9 +53,7 @@ class OverviewNavigationButton extends StatelessWidget {
child: Text(
this.title,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20
),
style: Theme.of(context).textTheme.subtitle1
)
),
],
......
......@@ -18,7 +18,7 @@ class BTOverviewWidget extends StatelessWidget {
initialData: '',
builder: (context, snapshot) => Text(
snapshot.data != '' ? snapshot.data : 'Unknown',
style: TextStyle(
style: Theme.of(context).textTheme.subtitle2.copyWith(
color: Colors.white
)
)
......@@ -37,9 +37,15 @@ class BTOverviewWidget extends StatelessWidget {
children: [
Icon(
icon,
size: IconTheme.of(context).size,
color: Colors.white,
),
Text((l >= 0) ? '$l%' : 'Unknown', style: TextStyle(color: Colors.white))