diff --git a/lib/constants/config.dart b/lib/constants/config.dart new file mode 100644 index 00000000..5b2ebb86 --- /dev/null +++ b/lib/constants/config.dart @@ -0,0 +1,7 @@ +class AppConfig { + ///彩云天气API Key + static const caiYunAPI = 'YETFbiaWktYHfCQE'; + + ///微信AppID + static const wechatAppId = 'wxd7bdef0d4849ddb8'; +} diff --git a/lib/main.dart b/lib/main.dart index e7d0e834..3388faab 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/constants/config.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -50,6 +51,7 @@ void main() async { jpush.applyPushAuthority( new NotificationSettingsIOS(sound: true, alert: true, badge: true)); DeveloperUtil.setDev(true); + registerWxApi(appId: AppConfig.wechatAppId); runApp(MyApp()); } @@ -61,12 +63,6 @@ class MyApp extends StatefulWidget { } class _MyAppState extends State { - @override - void initState() { - super.initState(); - registerWxApi(appId: 'wxd7bdef0d4849ddb8'); - } - @override Widget build(BuildContext context) { return MultiProvider( diff --git a/lib/pages/event_activity/voting_detail_page.dart b/lib/pages/event_activity/voting_detail_page.dart index 0c28e7f1..ce04c5b1 100644 --- a/lib/pages/event_activity/voting_detail_page.dart +++ b/lib/pages/event_activity/voting_detail_page.dart @@ -151,19 +151,15 @@ class _VotingDetailPageState extends State { finishVoted ? Row( children: [ - SizedBox( - width: 290.w, - child: LinearProgressIndicator( - value: _percent, - ), - ), + LinearProgressIndicator( + value: _percent * 0.01, + ).expand(), 8.w.widthBox, '${_percent.toStringAsFixed(2)}%' .text .color(ktextSubColor) .size(24.sp) - .make() - .expand(), + .make(), ], ) : SizedBox() diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index f6a71395..1f4c8490 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/constants/config.dart'; import 'package:flutter/material.dart'; import 'package:amap_flutter_location/amap_flutter_location.dart'; @@ -160,7 +161,7 @@ class AppProvider extends ChangeNotifier { // Location get location => _location; getWeather() async { Response response = await Dio().get( - 'https://api.caiyunapp.com/v2.5/YETFbiaWktYHfCQE/${_location['longitude']},${_location['latitude']}/realtime.json', + 'https://api.caiyunapp.com/v2.5/${AppConfig.caiYunAPI}/${_location['longitude']},${_location['latitude']}/realtime.json', ); LoggerData.addData(response); _weatherModel = RealTimeWeatherModel.fromJson(response.data);