Skip to content

Commit

Permalink
修复由于切换主题导致的输入框长按弹出黏贴
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Jan 16, 2019
1 parent 55548e9 commit 97b2d53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 6 additions & 1 deletion lib/common/utils/CommonUtils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,15 @@ class CommonUtils {
static pushTheme(Store store, int index) {
ThemeData themeData;
List<Color> colors = getThemeListColor();
themeData = new ThemeData(primarySwatch: colors[index], platform: TargetPlatform.iOS);
themeData = getThemeData(colors[index]);
store.dispatch(new RefreshThemeDataAction(themeData));
}


static getThemeData(Color color) {
return ThemeData(primarySwatch: color, platform: TargetPlatform.android);
}

/**
* 切换语言
*/
Expand Down
8 changes: 2 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'dart:async';

import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:event_bus/event_bus.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:gsy_github_app_flutter/common/event/HttpErrorEvent.dart';
Expand Down Expand Up @@ -34,10 +32,7 @@ class FlutterReduxApp extends StatelessWidget {
userInfo: User.empty(),
eventList: new List(),
trendList: new List(),
themeData: new ThemeData(
primarySwatch: GSYColors.primarySwatch,
platform: TargetPlatform.android,//fix #192
),
themeData: CommonUtils.getThemeData(GSYColors.primarySwatch),
locale: Locale('zh', 'CH')),
);

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

@override
Widget build(BuildContext context) {

return new StoreBuilder<GSYState>(builder: (context, store) {
///通过 StoreBuilder 和 Localizations 实现实时多语言切换
return new Localizations.override(
Expand Down
1 change: 1 addition & 0 deletions lib/page/LoginPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class _LoginPageState extends State<LoginPage> {
body: new Container(
color: Theme.of(context).primaryColor,
child: new Center(
//防止overFlow的现象
child: SafeArea(
child: SingleChildScrollView(
child: new Card(
Expand Down

0 comments on commit 97b2d53

Please sign in to comment.