mirror of
https://github.com/darkmoonight/Rain.git
synced 2025-06-28 20:19:58 +00:00
Fix refresh
This commit is contained in:
parent
aa125fcdc1
commit
6d0d0efe36
1 changed files with 62 additions and 62 deletions
|
@ -32,72 +32,72 @@ class _ListWeatherCardState extends State<ListWeatherCard> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final textTheme = context.textTheme;
|
final textTheme = context.textTheme;
|
||||||
final titleMedium = textTheme.titleMedium;
|
final titleMedium = textTheme.titleMedium;
|
||||||
return RefreshIndicator(
|
return Obx(
|
||||||
onRefresh: () async {
|
() => weatherController.weatherCards.isEmpty
|
||||||
await weatherController.updateCacheCard(true);
|
? Center(
|
||||||
setState(() {});
|
child: SingleChildScrollView(
|
||||||
},
|
child: Column(
|
||||||
child: Obx(
|
children: [
|
||||||
() => weatherController.weatherCards.isEmpty
|
Image.asset(
|
||||||
? Center(
|
'assets/icons/City.png',
|
||||||
child: SingleChildScrollView(
|
scale: 6,
|
||||||
child: Column(
|
),
|
||||||
children: [
|
SizedBox(
|
||||||
Image.asset(
|
width: Get.size.width * 0.8,
|
||||||
'assets/icons/City.png',
|
child: Text(
|
||||||
scale: 6,
|
'noWeatherCard'.tr,
|
||||||
),
|
textAlign: TextAlign.center,
|
||||||
SizedBox(
|
style: titleMedium?.copyWith(
|
||||||
width: Get.size.width * 0.8,
|
fontWeight: FontWeight.w600,
|
||||||
child: Text(
|
fontSize: 18,
|
||||||
'noWeatherCard'.tr,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: titleMedium?.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: NestedScrollView(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
|
||||||
return [
|
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: MyTextForm(
|
|
||||||
labelText: 'search'.tr,
|
|
||||||
type: TextInputType.text,
|
|
||||||
icon: const Icon(
|
|
||||||
Iconsax.search_normal_1,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
controller: searchTasks,
|
|
||||||
margin: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 10, vertical: 5),
|
|
||||||
onChanged: applyFilter,
|
|
||||||
iconButton: searchTasks.text.isNotEmpty
|
|
||||||
? IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
searchTasks.clear();
|
|
||||||
applyFilter('');
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
|
||||||
Iconsax.close_circle,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
];
|
],
|
||||||
},
|
),
|
||||||
body: WeatherCardList(searchCity: filter),
|
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
|
: NestedScrollView(
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
||||||
|
return [
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: MyTextForm(
|
||||||
|
labelText: 'search'.tr,
|
||||||
|
type: TextInputType.text,
|
||||||
|
icon: const Icon(
|
||||||
|
Iconsax.search_normal_1,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
controller: searchTasks,
|
||||||
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10, vertical: 5),
|
||||||
|
onChanged: applyFilter,
|
||||||
|
iconButton: searchTasks.text.isNotEmpty
|
||||||
|
? IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
searchTasks.clear();
|
||||||
|
applyFilter('');
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Iconsax.close_circle,
|
||||||
|
color: Colors.grey,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
body: RefreshIndicator(
|
||||||
|
onRefresh: () async {
|
||||||
|
await weatherController.updateCacheCard(true);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: WeatherCardList(searchCity: filter),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue