Two weather display options

This commit is contained in:
Yoshi 2024-07-10 21:59:36 +03:00
parent dd3339bc3b
commit 46e1546e5b
30 changed files with 339 additions and 163 deletions

View file

@ -12,6 +12,7 @@ class Settings {
bool materialColor = false;
bool amoledTheme = false;
bool roundDegree = false;
bool largeElement = false;
String? widgetBackgroundColor;
String? widgetTextColor;
String measurements = 'metric';

View file

@ -32,68 +32,73 @@ const SettingsSchema = CollectionSchema(
name: r'language',
type: IsarType.string,
),
r'location': PropertySchema(
r'largeElement': PropertySchema(
id: 3,
name: r'largeElement',
type: IsarType.bool,
),
r'location': PropertySchema(
id: 4,
name: r'location',
type: IsarType.bool,
),
r'materialColor': PropertySchema(
id: 4,
id: 5,
name: r'materialColor',
type: IsarType.bool,
),
r'measurements': PropertySchema(
id: 5,
id: 6,
name: r'measurements',
type: IsarType.string,
),
r'notifications': PropertySchema(
id: 6,
id: 7,
name: r'notifications',
type: IsarType.bool,
),
r'onboard': PropertySchema(
id: 7,
id: 8,
name: r'onboard',
type: IsarType.bool,
),
r'roundDegree': PropertySchema(
id: 8,
id: 9,
name: r'roundDegree',
type: IsarType.bool,
),
r'theme': PropertySchema(
id: 9,
id: 10,
name: r'theme',
type: IsarType.string,
),
r'timeEnd': PropertySchema(
id: 10,
id: 11,
name: r'timeEnd',
type: IsarType.string,
),
r'timeRange': PropertySchema(
id: 11,
id: 12,
name: r'timeRange',
type: IsarType.long,
),
r'timeStart': PropertySchema(
id: 12,
id: 13,
name: r'timeStart',
type: IsarType.string,
),
r'timeformat': PropertySchema(
id: 13,
id: 14,
name: r'timeformat',
type: IsarType.string,
),
r'widgetBackgroundColor': PropertySchema(
id: 14,
id: 15,
name: r'widgetBackgroundColor',
type: IsarType.string,
),
r'widgetTextColor': PropertySchema(
id: 15,
id: 16,
name: r'widgetTextColor',
type: IsarType.string,
)
@ -169,19 +174,20 @@ void _settingsSerialize(
writer.writeBool(offsets[0], object.amoledTheme);
writer.writeString(offsets[1], object.degrees);
writer.writeString(offsets[2], object.language);
writer.writeBool(offsets[3], object.location);
writer.writeBool(offsets[4], object.materialColor);
writer.writeString(offsets[5], object.measurements);
writer.writeBool(offsets[6], object.notifications);
writer.writeBool(offsets[7], object.onboard);
writer.writeBool(offsets[8], object.roundDegree);
writer.writeString(offsets[9], object.theme);
writer.writeString(offsets[10], object.timeEnd);
writer.writeLong(offsets[11], object.timeRange);
writer.writeString(offsets[12], object.timeStart);
writer.writeString(offsets[13], object.timeformat);
writer.writeString(offsets[14], object.widgetBackgroundColor);
writer.writeString(offsets[15], object.widgetTextColor);
writer.writeBool(offsets[3], object.largeElement);
writer.writeBool(offsets[4], object.location);
writer.writeBool(offsets[5], object.materialColor);
writer.writeString(offsets[6], object.measurements);
writer.writeBool(offsets[7], object.notifications);
writer.writeBool(offsets[8], object.onboard);
writer.writeBool(offsets[9], object.roundDegree);
writer.writeString(offsets[10], object.theme);
writer.writeString(offsets[11], object.timeEnd);
writer.writeLong(offsets[12], object.timeRange);
writer.writeString(offsets[13], object.timeStart);
writer.writeString(offsets[14], object.timeformat);
writer.writeString(offsets[15], object.widgetBackgroundColor);
writer.writeString(offsets[16], object.widgetTextColor);
}
Settings _settingsDeserialize(
@ -195,19 +201,20 @@ Settings _settingsDeserialize(
object.degrees = reader.readString(offsets[1]);
object.id = id;
object.language = reader.readStringOrNull(offsets[2]);
object.location = reader.readBool(offsets[3]);
object.materialColor = reader.readBool(offsets[4]);
object.measurements = reader.readString(offsets[5]);
object.notifications = reader.readBool(offsets[6]);
object.onboard = reader.readBool(offsets[7]);
object.roundDegree = reader.readBool(offsets[8]);
object.theme = reader.readStringOrNull(offsets[9]);
object.timeEnd = reader.readStringOrNull(offsets[10]);
object.timeRange = reader.readLongOrNull(offsets[11]);
object.timeStart = reader.readStringOrNull(offsets[12]);
object.timeformat = reader.readString(offsets[13]);
object.widgetBackgroundColor = reader.readStringOrNull(offsets[14]);
object.widgetTextColor = reader.readStringOrNull(offsets[15]);
object.largeElement = reader.readBool(offsets[3]);
object.location = reader.readBool(offsets[4]);
object.materialColor = reader.readBool(offsets[5]);
object.measurements = reader.readString(offsets[6]);
object.notifications = reader.readBool(offsets[7]);
object.onboard = reader.readBool(offsets[8]);
object.roundDegree = reader.readBool(offsets[9]);
object.theme = reader.readStringOrNull(offsets[10]);
object.timeEnd = reader.readStringOrNull(offsets[11]);
object.timeRange = reader.readLongOrNull(offsets[12]);
object.timeStart = reader.readStringOrNull(offsets[13]);
object.timeformat = reader.readString(offsets[14]);
object.widgetBackgroundColor = reader.readStringOrNull(offsets[15]);
object.widgetTextColor = reader.readStringOrNull(offsets[16]);
return object;
}
@ -229,27 +236,29 @@ P _settingsDeserializeProp<P>(
case 4:
return (reader.readBool(offset)) as P;
case 5:
return (reader.readString(offset)) as P;
case 6:
return (reader.readBool(offset)) as P;
case 6:
return (reader.readString(offset)) as P;
case 7:
return (reader.readBool(offset)) as P;
case 8:
return (reader.readBool(offset)) as P;
case 9:
return (reader.readStringOrNull(offset)) as P;
return (reader.readBool(offset)) as P;
case 10:
return (reader.readStringOrNull(offset)) as P;
case 11:
return (reader.readLongOrNull(offset)) as P;
return (reader.readStringOrNull(offset)) as P;
case 12:
return (reader.readStringOrNull(offset)) as P;
return (reader.readLongOrNull(offset)) as P;
case 13:
return (reader.readString(offset)) as P;
case 14:
return (reader.readStringOrNull(offset)) as P;
case 14:
return (reader.readString(offset)) as P;
case 15:
return (reader.readStringOrNull(offset)) as P;
case 16:
return (reader.readStringOrNull(offset)) as P;
default:
throw IsarError('Unknown property with id $propertyId');
}
@ -682,6 +691,16 @@ extension SettingsQueryFilter
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> largeElementEqualTo(
bool value) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo(
property: r'largeElement',
value: value,
));
});
}
QueryBuilder<Settings, Settings, QAfterFilterCondition> locationEqualTo(
bool value) {
return QueryBuilder.apply(this, (query) {
@ -1858,6 +1877,18 @@ extension SettingsQuerySortBy on QueryBuilder<Settings, Settings, QSortBy> {
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByLargeElement() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'largeElement', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByLargeElementDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'largeElement', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> sortByLocation() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'location', Sort.asc);
@ -2066,6 +2097,18 @@ extension SettingsQuerySortThenBy
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByLargeElement() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'largeElement', Sort.asc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByLargeElementDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'largeElement', Sort.desc);
});
}
QueryBuilder<Settings, Settings, QAfterSortBy> thenByLocation() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(r'location', Sort.asc);
@ -2246,6 +2289,12 @@ extension SettingsQueryWhereDistinct
});
}
QueryBuilder<Settings, Settings, QDistinct> distinctByLargeElement() {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'largeElement');
});
}
QueryBuilder<Settings, Settings, QDistinct> distinctByLocation() {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(r'location');
@ -2360,6 +2409,12 @@ extension SettingsQueryProperty
});
}
QueryBuilder<Settings, bool, QQueryOperations> largeElementProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'largeElement');
});
}
QueryBuilder<Settings, bool, QQueryOperations> locationProperty() {
return QueryBuilder.apply(this, (query) {
return query.addPropertyName(r'location');

View file

@ -70,7 +70,8 @@ class _SettingsPageState extends State<SettingsPage> {
context: context,
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom),
child: StatefulBuilder(
builder: (BuildContext context, setState) {
return SingleChildScrollView(
@ -79,7 +80,8 @@ class _SettingsPageState extends State<SettingsPage> {
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 15),
padding:
const EdgeInsets.symmetric(vertical: 15),
child: Text(
'appearance'.tr,
style: context.textTheme.titleLarge?.copyWith(
@ -142,6 +144,24 @@ class _SettingsPageState extends State<SettingsPage> {
newMaterialColor: value);
},
),
SettingCard(
elevation: 4,
icon: const Icon(Iconsax.additem),
text: 'largeElement'.tr,
switcher: true,
value: settings.largeElement,
onChange: (value) {
settings.largeElement = value;
isar.writeTxnSync(
() => isar.settings.putSync(settings),
);
MyApp.updateAppState(
context,
newLargeElement: value,
);
setState(() {});
},
),
const SizedBox(height: 10),
],
),
@ -161,7 +181,8 @@ class _SettingsPageState extends State<SettingsPage> {
context: context,
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom),
child: StatefulBuilder(
builder: (BuildContext context, setState) {
return SingleChildScrollView(
@ -170,7 +191,8 @@ class _SettingsPageState extends State<SettingsPage> {
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 15),
padding:
const EdgeInsets.symmetric(vertical: 15),
child: Text(
'functions'.tr,
style: context.textTheme.titleLarge?.copyWith(
@ -196,7 +218,8 @@ class _SettingsPageState extends State<SettingsPage> {
return AlertDialog.adaptive(
title: Text(
'location'.tr,
style: context.textTheme.titleLarge,
style:
context.textTheme.titleLarge,
),
content: Text('no_location'.tr,
style: context
@ -210,8 +233,8 @@ class _SettingsPageState extends State<SettingsPage> {
style: context
.textTheme.titleMedium
?.copyWith(
color:
Colors.blueAccent),
color: Colors
.blueAccent),
),
),
TextButton(
@ -232,7 +255,7 @@ class _SettingsPageState extends State<SettingsPage> {
);
},
);
return;
}
weatherController.getCurrentLocation();
@ -274,7 +297,8 @@ class _SettingsPageState extends State<SettingsPage> {
weatherController.notification(
weatherController.mainWeather);
} else {
flutterLocalNotificationsPlugin.cancelAll();
flutterLocalNotificationsPlugin
.cancelAll();
}
setState(() {});
}
@ -315,25 +339,28 @@ class _SettingsPageState extends State<SettingsPage> {
infoSettings: true,
infoWidget: _TextInfo(
info: settings.timeformat == '12'
? DateFormat.jm(locale.languageCode).format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeStart)
.format(context)))
: DateFormat.Hm(locale.languageCode).format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeStart)
.format(context))),
? DateFormat.jm(locale.languageCode)
.format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeStart)
.format(context)))
: DateFormat.Hm(locale.languageCode)
.format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeStart)
.format(context))),
),
onPressed: () async {
final TimeOfDay? timeStartPicker =
await showTimePicker(
context: context,
initialTime:
weatherController.timeConvert(timeStart),
initialTime: weatherController
.timeConvert(timeStart),
builder: (context, child) {
final Widget mediaQueryWrapper = MediaQuery(
final Widget mediaQueryWrapper =
MediaQuery(
data: MediaQuery.of(context).copyWith(
alwaysUse24HourFormat:
settings.timeformat == '12'
@ -356,7 +383,8 @@ class _SettingsPageState extends State<SettingsPage> {
newTimeStart:
timeStartPicker.format(context));
if (settings.notifications) {
flutterLocalNotificationsPlugin.cancelAll();
flutterLocalNotificationsPlugin
.cancelAll();
weatherController.notification(
weatherController.mainWeather);
}
@ -371,16 +399,18 @@ class _SettingsPageState extends State<SettingsPage> {
infoSettings: true,
infoWidget: _TextInfo(
info: settings.timeformat == '12'
? DateFormat.jm(locale.languageCode).format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeEnd)
.format(context)))
: DateFormat.Hm(locale.languageCode).format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeEnd)
.format(context))),
? DateFormat.jm(locale.languageCode)
.format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeEnd)
.format(context)))
: DateFormat.Hm(locale.languageCode)
.format(
DateFormat.Hm(locale.languageCode)
.parse(weatherController
.timeConvert(timeEnd)
.format(context))),
),
onPressed: () async {
final TimeOfDay? timeEndPicker =
@ -389,7 +419,8 @@ class _SettingsPageState extends State<SettingsPage> {
initialTime:
weatherController.timeConvert(timeEnd),
builder: (context, child) {
final Widget mediaQueryWrapper = MediaQuery(
final Widget mediaQueryWrapper =
MediaQuery(
data: MediaQuery.of(context).copyWith(
alwaysUse24HourFormat:
settings.timeformat == '12'
@ -412,7 +443,8 @@ class _SettingsPageState extends State<SettingsPage> {
newTimeEnd:
timeEndPicker.format(context));
if (settings.notifications) {
flutterLocalNotificationsPlugin.cancelAll();
flutterLocalNotificationsPlugin
.cancelAll();
weatherController.notification(
weatherController.mainWeather);
}
@ -438,7 +470,8 @@ class _SettingsPageState extends State<SettingsPage> {
context: context,
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom),
child: StatefulBuilder(
builder: (BuildContext context, setState) {
return SingleChildScrollView(
@ -447,7 +480,8 @@ class _SettingsPageState extends State<SettingsPage> {
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 15),
padding:
const EdgeInsets.symmetric(vertical: 15),
child: Text(
'data'.tr,
style: context.textTheme.titleLarge?.copyWith(
@ -555,7 +589,8 @@ class _SettingsPageState extends State<SettingsPage> {
context: context,
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom),
child: StatefulBuilder(
builder: (BuildContext context, setState) {
return SingleChildScrollView(
@ -564,7 +599,8 @@ class _SettingsPageState extends State<SettingsPage> {
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 15),
padding:
const EdgeInsets.symmetric(vertical: 15),
child: Text(
'widget'.tr,
style: context.textTheme.titleLarge?.copyWith(
@ -581,9 +617,11 @@ class _SettingsPageState extends State<SettingsPage> {
backgroundColor: context.theme.indicatorColor,
radius: 11,
child: CircleAvatar(
backgroundColor: widgetBackgroundColor.isEmpty
? context.theme.primaryColor
: HexColor.fromHex(widgetBackgroundColor),
backgroundColor:
widgetBackgroundColor.isEmpty
? context.theme.primaryColor
: HexColor.fromHex(
widgetBackgroundColor),
radius: 10,
),
),
@ -599,8 +637,9 @@ class _SettingsPageState extends State<SettingsPage> {
CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 15),
padding:
const EdgeInsets.symmetric(
vertical: 15),
child: Text(
'widgetBackground'.tr,
style: context
@ -609,8 +648,9 @@ class _SettingsPageState extends State<SettingsPage> {
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15),
padding:
const EdgeInsets.symmetric(
horizontal: 15),
child: Theme(
data: context.theme.copyWith(
inputDecorationTheme:
@ -625,7 +665,8 @@ class _SettingsPageState extends State<SettingsPage> {
child: ColorPicker(
color: widgetBackgroundColor
.isEmpty
? context.theme.primaryColor
? context
.theme.primaryColor
: HexColor.fromHex(
widgetBackgroundColor),
onChanged: (pickedColor) {
@ -686,8 +727,9 @@ class _SettingsPageState extends State<SettingsPage> {
CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 15),
padding:
const EdgeInsets.symmetric(
vertical: 15),
child: Text(
'widgetText'.tr,
style: context
@ -696,8 +738,9 @@ class _SettingsPageState extends State<SettingsPage> {
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15),
padding:
const EdgeInsets.symmetric(
horizontal: 15),
child: Theme(
data: context.theme.copyWith(
inputDecorationTheme:
@ -711,7 +754,8 @@ class _SettingsPageState extends State<SettingsPage> {
),
child: ColorPicker(
color: widgetTextColor.isEmpty
? context.theme.primaryColor
? context
.theme.primaryColor
: HexColor.fromHex(
widgetTextColor),
onChanged: (pickedColor) {
@ -769,7 +813,8 @@ class _SettingsPageState extends State<SettingsPage> {
context: context,
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom),
child: StatefulBuilder(
builder: (BuildContext context, setState) {
return ListView(
@ -828,7 +873,8 @@ class _SettingsPageState extends State<SettingsPage> {
context: context,
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom),
child: StatefulBuilder(
builder: (BuildContext context, setState) {
return SingleChildScrollView(
@ -837,7 +883,8 @@ class _SettingsPageState extends State<SettingsPage> {
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 15),
padding:
const EdgeInsets.symmetric(vertical: 15),
child: Text(
'support'.tr,
style: context.textTheme.titleLarge?.copyWith(
@ -878,7 +925,8 @@ class _SettingsPageState extends State<SettingsPage> {
context: context,
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom),
child: StatefulBuilder(
builder: (BuildContext context, setState) {
return SingleChildScrollView(
@ -901,8 +949,8 @@ class _SettingsPageState extends State<SettingsPage> {
icon: const Icon(Iconsax.voice_square),
text: 'Discord',
onPressed: () async {
final Uri url =
Uri.parse('https://discord.gg/JMMa9aHh8f');
final Uri url = Uri.parse(
'https://discord.gg/JMMa9aHh8f');
if (!await launchUrl(url,
mode: LaunchMode.externalApplication)) {
throw Exception('Could not launch $url');

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_glow/flutter_glow.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:rain/app/widgets/status/status_data.dart';
@ -34,64 +35,102 @@ class _WeatherNowState extends State<WeatherNow> {
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.only(bottom: 15),
child: Padding(
padding:
const EdgeInsets.only(top: 18, bottom: 18, left: 25, right: 15),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
return largeElement
? Padding(
padding: const EdgeInsets.only(bottom: 15),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 15),
Image(
image: AssetImage(statusWeather.getImageNow(widget.weather,
widget.time, widget.timeDay, widget.timeNight)),
fit: BoxFit.fill,
height: 200,
),
GlowText(
'${roundDegree ? widget.degree.round() : widget.degree}',
style: context.textTheme.displayLarge?.copyWith(
fontSize: 90,
fontWeight: FontWeight.w800,
),
),
Text(
statusWeather.getText(widget.weather),
style: context.textTheme.titleLarge,
),
const SizedBox(height: 5),
Text(
DateFormat.MMMMEEEEd(locale.languageCode).format(
DateTime.parse(widget.time),
),
style: context.textTheme.labelLarge?.copyWith(
color: Colors.grey,
),
),
],
),
)
: Card(
margin: const EdgeInsets.only(bottom: 15),
child: Padding(
padding: const EdgeInsets.only(
top: 18, bottom: 18, left: 25, right: 15),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
DateFormat.MMMMEEEEd(locale.languageCode).format(
DateTime.parse(widget.time),
),
style: context.textTheme.labelLarge?.copyWith(
color: Colors.grey,
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
DateFormat.MMMMEEEEd(locale.languageCode).format(
DateTime.parse(widget.time),
),
style: context.textTheme.labelLarge?.copyWith(
color: Colors.grey,
),
),
const SizedBox(height: 5),
Text(
statusWeather.getText(widget.weather),
style: context.textTheme.titleLarge
?.copyWith(fontSize: 20),
),
const SizedBox(height: 30),
Text(
statusData.getDegree(roundDegree
? widget.degree.round()
: widget.degree),
style: context.textTheme.displayMedium?.copyWith(
fontWeight: FontWeight.w800,
),
),
const SizedBox(height: 5),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(statusData.getDegree((widget.tempMin.round())),
style: context.textTheme.labelLarge),
Text(' / ',
style: context.textTheme.labelLarge
?.copyWith(color: Colors.grey)),
Text(statusData.getDegree((widget.tempMax.round())),
style: context.textTheme.labelLarge),
],
),
],
),
),
const SizedBox(height: 5),
Text(
statusWeather.getText(widget.weather),
style: context.textTheme.titleLarge?.copyWith(fontSize: 20),
),
const SizedBox(height: 30),
Text(
statusData.getDegree(
roundDegree ? widget.degree.round() : widget.degree),
style: context.textTheme.displayMedium?.copyWith(
fontWeight: FontWeight.w800,
),
),
const SizedBox(height: 5),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(statusData.getDegree((widget.tempMin.round())),
style: context.textTheme.labelLarge),
Text(' / ',
style: context.textTheme.labelLarge
?.copyWith(color: Colors.grey)),
Text(statusData.getDegree((widget.tempMax.round())),
style: context.textTheme.labelLarge),
],
Image(
image: AssetImage(statusWeather.getImageNow(widget.weather,
widget.time, widget.timeDay, widget.timeNight)),
fit: BoxFit.fill,
height: 140,
),
],
),
),
Image(
image: AssetImage(statusWeather.getImageNow(widget.weather,
widget.time, widget.timeDay, widget.timeNight)),
fit: BoxFit.fill,
height: 140,
),
],
),
),
);
);
}
}

View file

@ -21,7 +21,6 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
@override
Widget build(BuildContext context) {
const crossAxisCenterAlignment = CrossAxisAlignment.center;
final textTheme = context.textTheme;
final titleSmall = textTheme.titleSmall;
final titleLarge = textTheme.titleLarge;
@ -34,17 +33,16 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
children: [
Expanded(
child: Row(
crossAxisAlignment: crossAxisCenterAlignment,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Column(
crossAxisAlignment: crossAxisCenterAlignment,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'sunrise'.tr,
style: titleSmall,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
const SizedBox(height: 2),
Text(
@ -66,17 +64,16 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
),
Expanded(
child: Row(
crossAxisAlignment: crossAxisCenterAlignment,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Column(
crossAxisAlignment: crossAxisCenterAlignment,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'sunset'.tr,
style: titleSmall,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
const SizedBox(height: 2),
Text(

View file

@ -39,6 +39,7 @@ FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
bool amoledTheme = false;
bool materialColor = false;
bool roundDegree = false;
bool largeElement = false;
Locale locale = const Locale('en', 'US');
int timeRange = 1;
String timeStart = '09:00';
@ -165,6 +166,7 @@ class MyApp extends StatefulWidget {
bool? newAmoledTheme,
bool? newMaterialColor,
bool? newRoundDegree,
bool? newLargeElement,
Locale? newLocale,
int? newTimeRange,
String? newTimeStart,
@ -183,6 +185,9 @@ class MyApp extends StatefulWidget {
if (newRoundDegree != null) {
state.changeRoundDegree(newRoundDegree);
}
if (newLargeElement != null) {
state.changeLargeElement(newLargeElement);
}
if (newLocale != null) {
state.changeLocale(newLocale);
}
@ -228,6 +233,12 @@ class _MyAppState extends State<MyApp> {
});
}
void changeLargeElement(bool newLargeElement) {
setState(() {
largeElement = newLargeElement;
});
}
void changeTimeRange(int newTimeRange) {
setState(() {
timeRange = newTimeRange;
@ -269,6 +280,7 @@ class _MyAppState extends State<MyApp> {
amoledTheme = settings.amoledTheme;
materialColor = settings.materialColor;
roundDegree = settings.roundDegree;
largeElement = settings.largeElement;
locale = Locale(
settings.language!.substring(0, 2), settings.language!.substring(3));
timeRange = settings.timeRange ?? 1;

View file

@ -128,5 +128,6 @@ class BnIn {
'openMeteo': 'Open-Meteo থেকে ডেটা (CC-BY 4.0)',
'hourlyVariables': 'ঘণ্টায় আবহাওয়ার পরিবর্তনশীল',
'dailyVariables': 'দৈনিক আবহাওয়ার পরিবর্তনশীল',
'largeElement': 'বড় আবহাওয়া ডিসপ্লে',
};
}

View file

@ -128,5 +128,6 @@ class CsCz {
'openMeteo': 'Data z Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Hodinové meteorologické proměnné',
'dailyVariables': 'Denní meteorologické proměnné',
'largeElement': 'Velké zobrazení počasí',
};
}

View file

@ -129,5 +129,6 @@ class DaDk {
'openMeteo': 'Data fra Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Timevise vejrfaktorer',
'dailyVariables': 'Daglige vejrfaktorer',
'largeElement': 'Stort vejrdisplay',
};
}

View file

@ -130,5 +130,6 @@ class DeDe {
'openMeteo': 'Daten von Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Stündliche Wettervariablen',
'dailyVariables': 'Tägliche Wettervariablen',
'largeElement': 'Große Wetteranzeige',
};
}

View file

@ -129,5 +129,6 @@ class EnUs {
'openMeteo': 'Data by Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Hourly weather variables',
'dailyVariables': 'Daily weather variables',
'largeElement': 'Large weather display',
};
}

View file

@ -130,5 +130,6 @@ class EsEs {
'openMeteo': 'Datos de Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Variables meteorológicas horarias',
'dailyVariables': 'Variables meteorológicas diarias',
'largeElement': 'Visualización grande del clima',
};
}

View file

@ -129,5 +129,6 @@ class FaIr {
'openMeteo': 'داده‌ها از Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'متغیرهای ساعتی هواشناسی',
'dailyVariables': 'متغیرهای روزانه هواشناسی',
'largeElement': 'نمایش هواشناسی بزرگ',
};
}

View file

@ -130,5 +130,6 @@ class FrFr {
'openMeteo': 'Données de Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Variables météorologiques horaires',
'dailyVariables': 'Variables météorologiques quotidiennes',
'largeElement': 'Affichage météo grand format',
};
}

View file

@ -130,5 +130,6 @@ class GaIe {
'openMeteo': 'Sonraí ó Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Athrógacha aimsire uaireanta',
'dailyVariables': 'Athrógacha aimsire laethúla',
'largeElement': 'Taispeáint mór na haimsire',
};
}

View file

@ -127,5 +127,6 @@ class HiIn {
'openMeteo': 'Open-Meteo से डेटा (CC-BY 4.0)',
'hourlyVariables': 'घंटेवार मौसम चर',
'dailyVariables': 'दैनिक मौसम चर',
'largeElement': 'बड़े मौसम का प्रदर्शन',
};
}

View file

@ -130,5 +130,6 @@ class HuHu {
'openMeteo': 'Adatok az Open-Meteo-tól (CC-BY 4.0)',
'hourlyVariables': 'Óránkénti időjárási változók',
'dailyVariables': 'Napi időjárási változók',
'largeElement': 'Nagy méretű időjárás megjelenítése',
};
}

View file

@ -130,5 +130,6 @@ class ItIt {
'openMeteo': 'Dati da Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Variabili meteorologiche orarie',
'dailyVariables': 'Variabili meteorologiche giornaliere',
'largeElement': 'Visualizzazione grande elemento meteo',
};
}

View file

@ -129,5 +129,6 @@ class KaGe {
'openMeteo': 'მონაცემები Open-Meteo-დან (CC-BY 4.0)',
'hourlyVariables': 'საათობრივი ამინდის ცვლადები',
'dailyVariables': 'ყოველდღიური ამინდის ცვლადები',
'largeElement': 'გადიდი ამინდის გამოჩენა',
};
}

View file

@ -125,5 +125,6 @@ class KoKr {
'openMeteo': 'Open-Meteo의 데이터 (CC-BY 4.0)',
'hourlyVariables': '시간별 날씨 변수',
'dailyVariables': '일별 날씨 변수',
'largeElement': '큰 날씨 표시',
};
}

View file

@ -130,5 +130,6 @@ class NlNl {
'openMeteo': 'Gegevens van Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Uurlijkse weervariabelen',
'dailyVariables': 'Dagelijkse weervariabelen',
'largeElement': 'Groot weerbericht weergeven',
};
}

View file

@ -128,5 +128,6 @@ class PlPl {
'openMeteo': 'Dane z Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Godzinowe zmienne pogodowe',
'dailyVariables': 'Dzienne zmienne pogodowe',
'largeElement': 'Duże wyświetlanie pogody',
};
}

View file

@ -129,5 +129,6 @@ class PtBr {
'openMeteo': 'Dados do Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Variáveis meteorológicas horárias',
'dailyVariables': 'Variáveis meteorológicas diárias',
'largeElement': 'Exibição grande do clima',
};
}

View file

@ -128,5 +128,6 @@ class RoRo {
'openMeteo': 'Date de la Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Variabile meteorologice orare',
'dailyVariables': 'Variabile meteorologice zilnice',
'largeElement': 'Afișare mare a vremii',
};
}

View file

@ -129,5 +129,6 @@ class RuRu {
'openMeteo': 'Данные от Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Почасовые погодные условия',
'dailyVariables': 'Ежедневные погодные условия',
'largeElement': 'Отображение погоды большим элементом',
};
}

View file

@ -128,5 +128,6 @@ class SkSk {
'openMeteo': 'Údaje od Open-Meteo (CC-BY 4.0)',
'hourlyVariables': 'Hodinové meteorologické premenné',
'dailyVariables': 'Denné meteorologické premenné',
'largeElement': 'Veľké zobrazenie počasia',
};
}

View file

@ -128,5 +128,6 @@ class TrTr {
'openMeteo': 'Open-Meteo\'dan veriler (CC-BY 4.0)',
'hourlyVariables': 'Saatlik hava değişkenleri',
'dailyVariables': 'Günlük hava değişkenleri',
'largeElement': 'Büyük hava durumu gösterimi',
};
}

View file

@ -129,5 +129,6 @@ class UrPk {
'openMeteo': 'Open-Meteo سے ڈیٹا (CC-BY 4.0)',
'hourlyVariables': 'ہر گھنٹے کے موسمی متغیرات',
'dailyVariables': 'روزانہ کے موسمی متغیرات',
'largeElement': 'بڑے موسم کا ڈسپلے',
};
}

View file

@ -124,5 +124,6 @@ class ZhCh {
'openMeteo': '来自Open-Meteo的数据 (CC-BY 4.0)',
'hourlyVariables': '每小时天气变量',
'dailyVariables': '每日天气变量',
'largeElement': '大天气显示',
};
}

View file

@ -125,5 +125,6 @@ class ZhTw {
'openMeteo': '來自Open-Meteo的數據 (CC-BY 4.0)',
'hourlyVariables': '每小時天氣變量',
'dailyVariables': '每日天氣變量',
'largeElement': '大型天氣顯示',
};
}