Skip to content

Commit 6fb5380

Browse files
committed
[function] 城市管理支持背景动画
Signed-off-by: xiaweizi <1012126908@qq.com>
1 parent 3864b5a commit 6fb5380

File tree

5 files changed

+86
-79
lines changed

5 files changed

+86
-79
lines changed

lib/app/res/weather_type.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class WeatherUtils {
211211
case WeatherType.cloudyNight:
212212
return "assets/images/weather/cloudy_night.png";
213213
default:
214-
return "assets/images/weather/sunnyy.png";
214+
return "assets/images/weather/sunny.png";
215215
}
216216
}
217217

lib/views/bg/weather_main_bg.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,15 @@ class _WeatherMainBgState extends State<WeatherMainBg>
9797
Widget build(BuildContext context) {
9898
var width = MediaQuery.of(context).size.width;
9999
var height = MediaQuery.of(context).size.height;
100+
WeatherType weatherType = WeatherType.sunny;
101+
if (_weatherTypes != null && _weatherTypes.isNotEmpty) {
102+
weatherType = _weatherTypes[_index];
103+
}
100104
return Container(
101105
child: Stack(
102106
children: [
103107
WeatherBg(
104-
weatherType: _weatherTypes[_index],
108+
weatherType: weatherType,
105109
width: width,
106110
height: height,
107111
),

lib/views/pages/manager/manager_page.dart

Lines changed: 77 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class _ManagerPageState extends State<ManagerPage> {
129129
),
130130
onPressed: () {
131131
Navigator.of(context).pop();
132+
globalHeight = MediaQuery.of(context).size.height;
132133
},
133134
),
134135
),
@@ -161,82 +162,84 @@ class _ManagerPageState extends State<ManagerPage> {
161162
return Container();
162163
}
163164

164-
Widget _buildItemContentWidget(ManagerData data) => Stack(
165-
children: [
166-
WeatherColorBg(weatherType: data.weatherType, height: 100,),
167-
Container(
168-
height: 100,
169-
child: Row(
170-
children: [
171-
SizedBox(
172-
width: 14,
173-
),
174-
Expanded(
175-
child: Column(
176-
mainAxisSize: MainAxisSize.min,
177-
crossAxisAlignment: CrossAxisAlignment.start,
178-
children: [
179-
Row(
180-
crossAxisAlignment: CrossAxisAlignment.end,
181-
children: [
182-
Text(
183-
"${data.weatherDesc}",
184-
style: TextStyle(
185-
color: Color.fromARGB(200, 255, 255, 255),
186-
fontWeight: FontWeight.w500,
187-
letterSpacing: 1,
188-
fontSize: 12),
189-
),
190-
SizedBox(
191-
width: 5,
192-
),
193-
Text(
194-
"${data.todayTemperature}",
195-
style: TextStyle(
196-
color: Color.fromARGB(200, 255, 255, 255),
197-
fontWeight: FontWeight.w500,
198-
letterSpacing: 1,
199-
fontSize: 12),
200-
),
201-
],
202-
),
203-
SizedBox(
204-
height: 5,
205-
),
206-
Row(
207-
children: [
208-
Text(
209-
"${data.cityName}",
210-
style: TextStyle(
211-
color: Color.fromARGB(250, 255, 255, 255),
212-
fontWeight: FontWeight.w400,
213-
fontSize: 18),
214-
),
215-
SizedBox(width: 6,),
216-
Visibility(
217-
visible: data.isLocated == true,
218-
child: Icon(Icons.location_on, color: Colors.white, size: 18,),
219-
)
220-
],
221-
),
222-
],
223-
),
224-
),
225-
Text(
226-
"${data.currentTemperature}",
227-
style: TextStyle(
228-
color: Colors.white,
229-
fontWeight: FontWeight.w400,
230-
fontSize: 40),
165+
Widget _buildItemContentWidget(ManagerData data) {
166+
return Stack(
167+
children: [
168+
WeatherBg(weatherType: data.weatherType, height: 100, width: MediaQuery.of(context).size.width,),
169+
Container(
170+
height: 100,
171+
child: Row(
172+
children: [
173+
SizedBox(
174+
width: 14,
175+
),
176+
Expanded(
177+
child: Column(
178+
mainAxisSize: MainAxisSize.min,
179+
crossAxisAlignment: CrossAxisAlignment.start,
180+
children: [
181+
Row(
182+
crossAxisAlignment: CrossAxisAlignment.end,
183+
children: [
184+
Text(
185+
"${data.weatherDesc}",
186+
style: TextStyle(
187+
color: Color.fromARGB(200, 255, 255, 255),
188+
fontWeight: FontWeight.w500,
189+
letterSpacing: 1,
190+
fontSize: 12),
191+
),
192+
SizedBox(
193+
width: 5,
194+
),
195+
Text(
196+
"${data.todayTemperature}",
197+
style: TextStyle(
198+
color: Color.fromARGB(200, 255, 255, 255),
199+
fontWeight: FontWeight.w500,
200+
letterSpacing: 1,
201+
fontSize: 12),
202+
),
203+
],
204+
),
205+
SizedBox(
206+
height: 5,
207+
),
208+
Row(
209+
children: [
210+
Text(
211+
"${data.cityName}",
212+
style: TextStyle(
213+
color: Color.fromARGB(250, 255, 255, 255),
214+
fontWeight: FontWeight.w400,
215+
fontSize: 18),
216+
),
217+
SizedBox(width: 6,),
218+
Visibility(
219+
visible: data.isLocated == true,
220+
child: Icon(Icons.location_on, color: Colors.white, size: 18,),
221+
)
222+
],
223+
),
224+
],
231225
),
232-
SizedBox(
233-
width: 20,
234-
)
235-
],
236-
),
226+
),
227+
Text(
228+
"${data.currentTemperature}",
229+
style: TextStyle(
230+
color: Colors.white,
231+
fontWeight: FontWeight.w400,
232+
fontSize: 40),
233+
),
234+
SizedBox(
235+
width: 20,
236+
)
237+
],
237238
),
238-
],
239-
);
239+
),
240+
],
241+
);
242+
}
240243

241244
Widget _buildItemWidget(ManagerData data) {
242245
if (data.isLocated != true) {

pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ packages:
157157
name: flutter_weather_bg
158158
url: "https://pub.flutter-io.cn"
159159
source: hosted
160-
version: "2.1.0"
160+
version: "2.2.0"
161161
flutter_web_plugins:
162162
dependency: transitive
163163
description: flutter

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1515
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1616
# Read more about iOS versioning at
1717
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18-
version: 2.3.0+23
18+
version: 2.5.0+25
1919

2020
environment:
2121
sdk: ">=2.7.0 <3.0.0"
@@ -40,7 +40,7 @@ dependencies:
4040
package_info: ^0.4.3
4141
ota_update: ^2.4.1
4242
flutter_tts: ^1.2.7
43-
flutter_weather_bg: ^2.1.0
43+
flutter_weather_bg: ^2.2.0
4444

4545
# The following adds the Cupertino Icons font to your application.
4646
# Use with the CupertinoIcons class for iOS style icons.

0 commit comments

Comments
 (0)