Commit 681aed67 authored by 779285112's avatar 779285112

优化版本显示

parent 2ce2be65
...@@ -10,6 +10,7 @@ import 'package:app/ui/widgets/widget_index.dart'; ...@@ -10,6 +10,7 @@ import 'package:app/ui/widgets/widget_index.dart';
import 'package:app/utils/navigator_util.dart'; import 'package:app/utils/navigator_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:package_info/package_info.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import '../webview.dart'; import '../webview.dart';
...@@ -23,12 +24,19 @@ class SettingPage extends BaseView { ...@@ -23,12 +24,19 @@ class SettingPage extends BaseView {
String _cacheSize = '0'; String _cacheSize = '0';
class SettingPageState extends BaseState<SettingViewModel> { class SettingPageState extends BaseState<SettingViewModel> {
String version = '1.0.0';
@override @override
void initState() { void initState() {
super.initState(); super.initState();
loadCache(); loadCache();
viewModel.dataStream.listen((user) {}, onError: (error) { initVersion();
//Toast.toast(context, error); }
void initVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
setState(() {
version = packageInfo.version;
}); });
} }
...@@ -192,7 +200,7 @@ class SettingPageState extends BaseState<SettingViewModel> { ...@@ -192,7 +200,7 @@ class SettingPageState extends BaseState<SettingViewModel> {
GestureDetector( GestureDetector(
onTap: () {}, onTap: () {},
child: TextCustom( child: TextCustom(
text: 'V1.0', text: 'V$version',
), ),
), ),
false), false),
......
...@@ -254,6 +254,13 @@ packages: ...@@ -254,6 +254,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.7" version: "1.1.7"
package_info:
dependency: "direct main"
description:
name: package_info
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.0+12"
path: path:
dependency: transitive dependency: transitive
description: description:
......
...@@ -11,7 +11,7 @@ description: A new Flutter application. ...@@ -11,7 +11,7 @@ description: A new Flutter application.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.1+1 version: 1.0.1
environment: environment:
sdk: ">=2.1.0 <3.0.0" sdk: ">=2.1.0 <3.0.0"
...@@ -76,6 +76,8 @@ dependencies: ...@@ -76,6 +76,8 @@ dependencies:
keyboard_visibility: any keyboard_visibility: any
#获取设备信息 #获取设备信息
device_info: ^0.4.0+4 device_info: ^0.4.0+4
#版本信息
package_info: 0.4.0+12
#tabBar #tabBar
#ace_bottom_navigation_bar: ^0.0.4 #ace_bottom_navigation_bar: ^0.0.4
# 仅定位 # 仅定位
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment