Skip to content

Commit dc3774f

Browse files
committed
style:优化二级页面主题样式
1 parent 87c709b commit dc3774f

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.flutter.beer"
3-
android:versionCode="1"
4-
android:versionName="1.0"
53
android:installLocation="preferExternal">
64

75
<!-- The INTERNET permission is required for development. Specifically,

lib/components/headerComp.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Index extends StatelessWidget {
88
return Text(
99
this.text,
1010
style: TextStyle(
11-
// fontStyle: FontStyle.normal,
11+
color: Theme.of(context).primaryTextTheme.title.color
1212
),
1313
);
1414
}

lib/components/webviewComp.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'headerComp.dart' as Header;
3-
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart' show FlutterWebviewPlugin, WebviewScaffold;
3+
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'
4+
show FlutterWebviewPlugin, WebviewScaffold;
45

56
class Index extends StatelessWidget {
67
final String url;
@@ -18,17 +19,20 @@ class Index extends StatelessWidget {
1819
Widget build(BuildContext context) {
1920
return WebviewScaffold(
2021
url: this.url,
21-
appBar: new AppBar(
22-
title: Header.Index(this.title),
22+
enableAppScheme: false,
23+
appBar: AppBar(
24+
title: Text(
25+
this.title,
26+
),
27+
leading: IconButton(
28+
icon: Icon(Icons.arrow_back),
29+
color: Theme.of(context).primaryTextTheme.title.color,
30+
onPressed: () => Navigator.pop(context),
31+
),
2332
),
2433
withZoom: true,
2534
withLocalStorage: true,
2635
hidden: true,
27-
// initialChild: Container(
28-
// child: const Center(
29-
// child: CircularProgressIndicator(),
30-
// ),
31-
// ),
3236
);
3337
}
3438
}

lib/components/widgetComp.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,14 @@ class IndexState extends State<Index> {
8484
this.model = model;
8585
return Scaffold(
8686
appBar: AppBar(
87-
/* title: Header.Index(
88-
this.title,
89-
), */
87+
title: Text(this.title),
9088
elevation: 0,
91-
backgroundColor: Color(AppTheme.secondColor),
9289
actions: this.getActions(
9390
context,
9491
),
9592
leading: IconButton(
9693
icon: Icon(Icons.arrow_back),
97-
color: Color(AppTheme.blackColor),
94+
color: Theme.of(context).primaryTextTheme.title.color,
9895
onPressed: () => Navigator.pop(context),
9996
),
10097
),
@@ -133,7 +130,7 @@ class IndexState extends State<Index> {
133130
getActions(context) {
134131
return [
135132
IconButton(
136-
color: Color(AppTheme.blackColor),
133+
color: Theme.of(context).primaryTextTheme.title.color,
137134
icon: Icon(
138135
Icons.insert_link,
139136
),
@@ -154,7 +151,7 @@ class IndexState extends State<Index> {
154151
), */
155152
IconButton(
156153
icon: Icon(Icons.share),
157-
color: Color(AppTheme.blackColor),
154+
color: Theme.of(context).primaryTextTheme.title.color,
158155
onPressed: () {
159156
final String msg =
160157
this.model.config.state.env.githubAssetOrigin + this.mdUrl;

lib/config/theme.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'color.dart' show materialColor;
77
*/
88

99
class AppTheme {
10-
1110
//static int mainColor = 0xFFD32F2F;
1211
static int mainColor = materialColor['red'];
1312
static int secondColor = 0xFFFFFFFF;
@@ -17,7 +16,7 @@ class AppTheme {
1716
static int lineColor = 0xFFEEEEEE;
1817
static getThemeData(String theme) {
1918
print('==================================getThemeData=$theme');
20-
mainColor =materialColor[theme];
19+
mainColor = materialColor[theme];
2120
ThemeData themData = ThemeData(
2221
textTheme: TextTheme(
2322
body1: TextStyle(
@@ -37,6 +36,14 @@ class AppTheme {
3736
),
3837
accentColor: Colors.grey, // 选中颜色
3938
primaryColor: Color(mainColor), // appbar背景
39+
primaryTextTheme:TextTheme(
40+
title:TextStyle(
41+
// color: Colors.red
42+
),
43+
button: TextStyle(
44+
color: Colors.red
45+
)
46+
),
4047
scaffoldBackgroundColor: Color(secondColor), // 整体的scaffold背景颜色
4148
);
4249
return themData;

0 commit comments

Comments
 (0)