mirror of
https://github.com/darkmoonight/Rain.git
synced 2025-06-28 12:09:57 +00:00
Fix anim new add form && Add feels to the top tile
This commit is contained in:
parent
fc246ac5a2
commit
dd57938153
8 changed files with 89 additions and 42 deletions
|
@ -91,6 +91,7 @@ class _InfoWeatherCardState extends State<InfoWeatherCard> {
|
|||
time: weatherCard.time![timeNow],
|
||||
weather: weatherCard.weathercode![timeNow],
|
||||
degree: weatherCard.temperature2M![timeNow],
|
||||
feels: weatherCard.apparentTemperature![timeNow]!,
|
||||
timeDay: weatherCard.sunrise![dayNow],
|
||||
timeNight: weatherCard.sunset![dayNow],
|
||||
tempMax: weatherCard.temperature2MMax![dayNow]!,
|
||||
|
|
|
@ -15,7 +15,8 @@ class CreateWeatherCard extends StatefulWidget {
|
|||
State<CreateWeatherCard> createState() => _CreateWeatherCardState();
|
||||
}
|
||||
|
||||
class _CreateWeatherCardState extends State<CreateWeatherCard> {
|
||||
class _CreateWeatherCardState extends State<CreateWeatherCard>
|
||||
with SingleTickerProviderStateMixin {
|
||||
bool isLoading = false;
|
||||
final formKey = GlobalKey<FormState>();
|
||||
final _focusNode = FocusNode();
|
||||
|
@ -26,14 +27,41 @@ class _CreateWeatherCardState extends State<CreateWeatherCard> {
|
|||
final _controllerCity = TextEditingController();
|
||||
final _controllerDistrict = TextEditingController();
|
||||
|
||||
textTrim(value) {
|
||||
late AnimationController _animationController;
|
||||
late Animation<double> _animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_animationController = AnimationController(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
vsync: this,
|
||||
);
|
||||
_animation = CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animationController.dispose();
|
||||
_controller.dispose();
|
||||
_controllerLat.dispose();
|
||||
_controllerLon.dispose();
|
||||
_controllerCity.dispose();
|
||||
_controllerDistrict.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void textTrim(TextEditingController value) {
|
||||
value.text = value.text.trim();
|
||||
while (value.text.contains(' ')) {
|
||||
value.text = value.text.replaceAll(' ', ' ');
|
||||
}
|
||||
}
|
||||
|
||||
void fillController(selection) {
|
||||
void fillController(Result selection) {
|
||||
_controllerLat.text = '${selection.latitude}';
|
||||
_controllerLon.text = '${selection.longitude}';
|
||||
_controllerCity.text = selection.name;
|
||||
|
@ -46,6 +74,17 @@ class _CreateWeatherCardState extends State<CreateWeatherCard> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const kTextFieldElevation = 4.0;
|
||||
bool showButton = _controllerLon.text.isNotEmpty &&
|
||||
_controllerLat.text.isNotEmpty &&
|
||||
_controllerCity.text.isNotEmpty &&
|
||||
_controllerDistrict.text.isNotEmpty;
|
||||
|
||||
if (showButton) {
|
||||
_animationController.forward();
|
||||
} else {
|
||||
_animationController.reverse();
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||
child: Form(
|
||||
|
@ -62,12 +101,11 @@ class _CreateWeatherCardState extends State<CreateWeatherCard> {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(10, 15, 10, 5),
|
||||
padding: const EdgeInsets.only(top: 14, bottom: 7),
|
||||
child: Text(
|
||||
'create'.tr,
|
||||
style: context.textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
style: context.textTheme.titleLarge
|
||||
?.copyWith(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
|
@ -214,11 +252,9 @@ class _CreateWeatherCardState extends State<CreateWeatherCard> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 10),
|
||||
child: Visibility(
|
||||
visible: _controllerLon.text.isNotEmpty &&
|
||||
_controllerLat.text.isNotEmpty &&
|
||||
_controllerCity.text.isNotEmpty &&
|
||||
_controllerDistrict.text.isNotEmpty,
|
||||
child: SizeTransition(
|
||||
sizeFactor: _animation,
|
||||
axisAlignment: -1.0,
|
||||
child: MyTextButton(
|
||||
buttonName: 'done'.tr,
|
||||
onPressed: () async {
|
||||
|
|
|
@ -73,6 +73,7 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
time: mainWeather.time![hourOfDay],
|
||||
weather: mainWeather.weathercode![hourOfDay],
|
||||
degree: mainWeather.temperature2M![hourOfDay],
|
||||
feels: mainWeather.apparentTemperature![hourOfDay]!,
|
||||
timeDay: sunrise,
|
||||
timeNight: sunset,
|
||||
tempMax: tempMax!,
|
||||
|
|
|
@ -123,6 +123,8 @@ class _InfoDailyCardState extends State<InfoDailyCard> {
|
|||
weatherData.weathercode![startIndex + hourOfDay],
|
||||
degree: weatherData
|
||||
.temperature2M![startIndex + hourOfDay],
|
||||
feels: weatherData
|
||||
.apparentTemperature![startIndex + hourOfDay]!,
|
||||
time: weatherData.time![startIndex + hourOfDay],
|
||||
timeDay: sunrise,
|
||||
timeNight: sunset,
|
||||
|
|
|
@ -36,9 +36,6 @@ class _WeatherDailyState extends State<WeatherDaily> {
|
|||
final weatherCodeDaily = weatherData.weathercodeDaily ?? [];
|
||||
final textTheme = context.textTheme;
|
||||
final labelLarge = textTheme.labelLarge;
|
||||
final bodyMediumGrey = textTheme.bodyMedium?.copyWith(
|
||||
color: Colors.grey,
|
||||
);
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
|
@ -107,7 +104,7 @@ class _WeatherDailyState extends State<WeatherDaily> {
|
|||
),
|
||||
Text(
|
||||
' / ',
|
||||
style: bodyMediumGrey,
|
||||
style: labelLarge,
|
||||
),
|
||||
Text(
|
||||
statusData.getDegree(
|
||||
|
|
|
@ -16,6 +16,7 @@ class WeatherNow extends StatefulWidget {
|
|||
required this.timeNight,
|
||||
required this.tempMax,
|
||||
required this.tempMin,
|
||||
required this.feels,
|
||||
});
|
||||
final String time;
|
||||
final String timeDay;
|
||||
|
@ -24,6 +25,7 @@ class WeatherNow extends StatefulWidget {
|
|||
final double degree;
|
||||
final double tempMax;
|
||||
final double tempMin;
|
||||
final double feels;
|
||||
|
||||
@override
|
||||
State<WeatherNow> createState() => _WeatherNowState();
|
||||
|
@ -97,6 +99,16 @@ class _WeatherNowState extends State<WeatherNow> {
|
|||
style: context.textTheme.titleLarge
|
||||
?.copyWith(fontSize: 20),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('feels'.tr,
|
||||
style: context.textTheme.bodyMedium),
|
||||
Text(' • ', style: context.textTheme.bodyMedium),
|
||||
Text(statusData.getDegree(widget.feels.round()),
|
||||
style: context.textTheme.bodyMedium),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
statusData.getDegree(roundDegree
|
||||
|
@ -112,9 +124,7 @@ class _WeatherNowState extends State<WeatherNow> {
|
|||
children: [
|
||||
Text(statusData.getDegree((widget.tempMin.round())),
|
||||
style: context.textTheme.labelLarge),
|
||||
Text(' / ',
|
||||
style: context.textTheme.labelLarge
|
||||
?.copyWith(color: Colors.grey)),
|
||||
Text(' / ', style: context.textTheme.labelLarge),
|
||||
Text(statusData.getDegree((widget.tempMax.round())),
|
||||
style: context.textTheme.labelLarge),
|
||||
],
|
||||
|
|
40
pubspec.lock
40
pubspec.lock
|
@ -173,18 +173,18 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: connectivity_plus
|
||||
sha256: db7a4e143dc72cc3cb2044ef9b052a7ebfe729513e6a82943bc3526f784365b8
|
||||
sha256: "3e7d1d9dbae40ae82cbe6c23c518f0c4ffe32764ee9749b9a99d32cbac8734f6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.3"
|
||||
version: "6.0.4"
|
||||
connectivity_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: connectivity_plus_platform_interface
|
||||
sha256: b6a56efe1e6675be240de39107281d4034b64ac23438026355b4234042a35adb
|
||||
sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.1"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -237,18 +237,18 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: device_info_plus
|
||||
sha256: eead12d1a1ed83d8283ab4c2f3fca23ac4082f29f25f29dff0f758f57d06ec91
|
||||
sha256: "93429694c9253d2871b3af80cf11b3cbb5c65660d402ed7bf69854ce4a089f82"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.1.0"
|
||||
version: "10.1.1"
|
||||
device_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info_plus_platform_interface
|
||||
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
|
||||
sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
version: "7.0.1"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -474,10 +474,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_android
|
||||
sha256: "00c7177a95823dd3ee35ef42fd8666cd27d219ae14cea472ac76a21dff43000b"
|
||||
sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.6.0"
|
||||
version: "4.6.1"
|
||||
geolocator_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -770,18 +770,18 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info_plus
|
||||
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0
|
||||
sha256: "4de6c36df77ffbcef0a5aefe04669d33f2d18397fea228277b852a2d4e58e860"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.0.0"
|
||||
version: "8.0.1"
|
||||
package_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_info_plus_platform_interface
|
||||
sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e
|
||||
sha256: ac1f4a4847f1ade8e6a87d1f39f5d7c67490738642e2542f559ec38c37489a66
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -802,10 +802,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "30c5aa827a6ae95ce2853cdc5fe3971daaac00f6f081c419c013f7f57bff2f5e"
|
||||
sha256: "490539678396d4c3c0b06efdaab75ae60675c3e0c66f72bc04c2e2c1e0e2abeb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.7"
|
||||
version: "2.2.9"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1063,10 +1063,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "95d8027db36a0e52caf55680f91e33ea6aa12a3ce608c90b06f4e429a21067ac"
|
||||
sha256: "678979703e10d7862c551c736fe6b9f185261bddf141b46672063b99790bc700"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.5"
|
||||
version: "6.3.7"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1183,10 +1183,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: win32_registry
|
||||
sha256: "10589e0d7f4e053f2c61023a31c9ce01146656a70b7b7f0828c0b46d7da2a9bb"
|
||||
sha256: "723b7f851e5724c55409bb3d5a32b203b3afe8587eaf5dafb93a5fed8ecda0d6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
version: "1.1.4"
|
||||
workmanager:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -37,9 +37,9 @@ dependencies:
|
|||
# quick_settings: ^1.0.1
|
||||
json_annotation: ^4.9.0
|
||||
flutter_timezone: ^2.1.0
|
||||
device_info_plus: ^10.1.0
|
||||
package_info_plus: ^8.0.0
|
||||
connectivity_plus: ^6.0.3
|
||||
device_info_plus: ^10.1.1
|
||||
package_info_plus: ^8.0.1
|
||||
connectivity_plus: ^6.0.4
|
||||
freezed_annotation: ^2.4.4
|
||||
isar_flutter_libs:
|
||||
version: ^3.1.7
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue