Rain/lib/app/widgets/daily/weather_more.dart

72 lines
2 KiB
Dart
Raw Normal View History

2023-06-17 20:57:57 +03:00
import 'package:flutter/material.dart';
import 'package:get/get.dart';
2024-08-12 21:03:35 +03:00
import 'package:iconsax_plus/iconsax_plus.dart';
import 'package:rain/app/data/weather.dart';
2023-09-03 09:08:43 +03:00
import 'package:rain/app/widgets/daily/info_daily_card.dart';
import 'package:rain/app/widgets/daily/list_daily_card.dart';
2023-06-17 20:57:57 +03:00
class WeatherMore extends StatefulWidget {
const WeatherMore({
super.key,
2023-09-03 13:13:44 +03:00
required this.weatherData,
2023-06-17 20:57:57 +03:00
});
final WeatherCard weatherData;
2023-06-17 20:57:57 +03:00
@override
State<WeatherMore> createState() => _WeatherMoreState();
}
class _WeatherMoreState extends State<WeatherMore> {
@override
Widget build(BuildContext context) {
const transparent = Colors.transparent;
final weatherData = widget.weatherData;
final timeDaily = weatherData.timeDaily ?? [];
2023-06-17 20:57:57 +03:00
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
centerTitle: true,
leading: IconButton(
onPressed: () {
Get.back();
},
icon: const Icon(
2024-08-12 21:03:35 +03:00
IconsaxPlusLinear.arrow_left_3,
2023-06-17 20:57:57 +03:00
size: 20,
),
splashColor: transparent,
highlightColor: transparent,
2023-06-17 20:57:57 +03:00
),
title: Text(
'weatherMore'.tr,
2023-07-14 20:19:43 +03:00
style: context.textTheme.titleMedium?.copyWith(
2023-07-12 20:52:25 +03:00
fontWeight: FontWeight.w600,
fontSize: 18,
),
2023-06-17 20:57:57 +03:00
),
),
2023-09-29 15:45:50 +03:00
body: SafeArea(
child: ListView.builder(
itemCount: timeDaily.length,
2023-09-29 15:45:50 +03:00
itemBuilder: (context, index) => GestureDetector(
onTap: () => Get.to(
() => InfoDailyCard(
weatherData: weatherData,
2023-09-29 15:45:50 +03:00
index: index,
),
transition: Transition.downToUp,
),
child: ListDailyCard(
timeDaily: timeDaily[index],
weathercodeDaily: weatherData.weathercodeDaily![index],
temperature2MMax: weatherData.temperature2MMax![index],
temperature2MMin: weatherData.temperature2MMin![index],
2023-07-09 23:41:51 +03:00
),
2023-06-17 20:57:57 +03:00
),
),
),
);
}
}