Skip to content

Commit e798b2b

Browse files
committed
修复由于切换主题导致的输入框长按弹出黏贴
1 parent cf8ac23 commit e798b2b

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

lib/common/utils/CommonUtils.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,15 @@ class CommonUtils {
137137
static pushTheme(Store store, int index) {
138138
ThemeData themeData;
139139
List<Color> colors = getThemeListColor();
140-
themeData = new ThemeData(primarySwatch: colors[index], platform: TargetPlatform.iOS);
140+
themeData = getThemeData(colors[index]);
141141
store.dispatch(new RefreshThemeDataAction(themeData));
142142
}
143143

144+
145+
static getThemeData(Color color) {
146+
return ThemeData(primarySwatch: color, platform: TargetPlatform.android);
147+
}
148+
144149
/**
145150
* 切换语言
146151
*/

lib/main.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import 'dart:async';
22

3-
import 'package:flutter/cupertino.dart';
43
import 'package:flutter/foundation.dart';
54
import 'package:flutter/material.dart';
6-
import 'package:event_bus/event_bus.dart';
75
import 'package:flutter_localizations/flutter_localizations.dart';
86
import 'package:fluttertoast/fluttertoast.dart';
97
import 'package:gsy_github_app_flutter/common/event/HttpErrorEvent.dart';
@@ -34,10 +32,7 @@ class FlutterReduxApp extends StatelessWidget {
3432
userInfo: User.empty(),
3533
eventList: new List(),
3634
trendList: new List(),
37-
themeData: new ThemeData(
38-
primarySwatch: GSYColors.primarySwatch,
39-
platform: TargetPlatform.android,//fix #192
40-
),
35+
themeData: CommonUtils.getThemeData(GSYColors.primarySwatch),
4136
locale: Locale('zh', 'CH')),
4237
);
4338

@@ -99,6 +94,7 @@ class _GSYLocalizations extends State<GSYLocalizations> {
9994

10095
@override
10196
Widget build(BuildContext context) {
97+
10298
return new StoreBuilder<GSYState>(builder: (context, store) {
10399
///通过 StoreBuilder 和 Localizations 实现实时多语言切换
104100
return new Localizations.override(

lib/page/LoginPage.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class _LoginPageState extends State<LoginPage> {
6161
body: new Container(
6262
color: Theme.of(context).primaryColor,
6363
child: new Center(
64+
//防止overFlow的现象
6465
child: SafeArea(
6566
child: SingleChildScrollView(
6667
child: new Card(

0 commit comments

Comments
 (0)