Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7a6b974

Browse files
panel进行主题适配
1 parent 7a57607 commit 7a6b974

File tree

8 files changed

+319
-275
lines changed

8 files changed

+319
-275
lines changed

‎example/lib/main.dart‎

Lines changed: 128 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MyApp extends StatelessWidget {
1010
@override
1111
Widget build(BuildContext context) {
1212
return WeUIApp(
13-
theme: WeUIThemeData.dark(),
13+
theme: WeUIThemeData.light(),
1414
child: MaterialApp(
1515
title: 'Flutter Demo',
1616
color: Colors.red,
@@ -68,93 +68,145 @@ class _MyHomePageState extends State<MyHomePage> {
6868
body: ListView(
6969
//physics: BouncingScrollPhysics(),
7070
children: <Widget>[
71-
Center(
72-
// Center is a layout widget. It takes a single child and positions it
73-
// in the middle of the parent.
74-
child: Column(
71+
Column(
7572
mainAxisAlignment: MainAxisAlignment.center,
76-
children: <Widget>[
77-
Button(text: 'dark',onPress: dark),
78-
Button(type: ButtonType.primay,text: 'light',onPress: light,),
79-
Button(type: ButtonType.warn,onPress: (){
80-
Toast.success(context, "dfsdf");
81-
},),
82-
Button(loading: true,),
83-
Button(type: ButtonType.primay,loading: true,),
84-
Button(type: ButtonType.warn,loading: true,),
85-
Button(disabled: true,),
86-
Button(type: ButtonType.primay,disabled: true,),
87-
Button(type: ButtonType.warn,onPress: (){
88-
Toast.close(context);
89-
},),
90-
Button(mini:true,onPress: ()async{
91-
Toast.loading(context, "dsfsfd");
92-
await Future.delayed(Duration(seconds: 2));
93-
Toast.close(context);
94-
}),
95-
PreView(
96-
header: PreViewHeader(
97-
label: "Header",
98-
value: "sdfs",
99-
),
100-
body: PreViewBody(
101-
children: [
102-
PreViewItem(
73+
crossAxisAlignment: CrossAxisAlignment.start,
74+
children: <Widget>[
75+
Button(text: 'dark',onPress: dark),
76+
Button(type: ButtonType.primay,text: 'light',onPress: light,),
77+
Button(type: ButtonType.warn,onPress: (){
78+
Toast.success(context, "dfsdf");
79+
},),
80+
Button(loading: true,),
81+
Button(type: ButtonType.primay,loading: true,),
82+
Button(type: ButtonType.warn,loading: true,),
83+
Button(disabled: true,),
84+
Button(type: ButtonType.primay,disabled: true,),
85+
Button(type: ButtonType.warn,onPress: (){
86+
Toast.close(context);
87+
},),
88+
Button(mini:true,onPress: ()async{
89+
Toast.loading(context, "dsfsfd");
90+
await Future.delayed(Duration(seconds: 2));
91+
Toast.close(context);
92+
}),
93+
PreView(
94+
header: PreViewHeader(
95+
label: "Header",
96+
value: "sdfs",
97+
),
98+
body: PreViewBody(
99+
children: [
100+
PreViewItem(
101+
label: 'Item',
102+
value:'123'
103+
),
104+
PreViewItem(
103105
label: 'Item',
104106
value:'123'
105-
),
106-
PreViewItem(
107-
label: 'Item',
108-
value:'123'
109-
),
110-
PreViewItem(
111-
label: 'Item',
112-
value:'123'
113-
),
114-
PreViewItem(
115-
label: 'Item',
116-
value:'123fsafsafsafsfsafsfssfwerrqreqwrwrsafsaffsfsfsfsfsfsfsfsfsf'
117-
)
118-
],
119-
),
120-
footer: PreViewFooter(
121-
children: [
122-
PreViewButton(text: "sdfs",),
123-
PreViewButton(text: "sfds",primary: true,onPressed: (){},)
124-
],
125-
),
107+
),
108+
PreViewItem(
109+
label: 'Item',
110+
value:'123'
111+
),
112+
PreViewItem(
113+
label: 'Item',
114+
value:'123fsafsafsafsfsafsfssfwerrqreqwrwrsafsaffsfsfsfsfsfsfsfsfsf'
115+
)
116+
],
117+
),
118+
footer: PreViewFooter(
119+
children: [
120+
PreViewButton(text: "sdfs",),
121+
PreViewButton(text: "sfds",primary: true,onPressed: (){},)
122+
],
123+
),
124+
),
125+
Panel(
126+
header: PanelHeader(child: Text('文字列表组合'),
126127
),
127-
buildCells(context),
128-
WeUIApp(child:
129-
Footer(
130-
// text: "sdfsfd",
131-
links: [Link(text: "sdfds"), Link(text: "sdfsf")],
132-
),),
133-
Article(
128+
child: Column(
129+
crossAxisAlignment: CrossAxisAlignment.start,
134130
children: <Widget>[
135-
H1(
136-
text: "大标题",
131+
MediaBox(
132+
onPress:(){},
133+
child: Column(
134+
crossAxisAlignment: CrossAxisAlignment.start,
135+
children: <Widget>[
136+
MediaBoxTitle(
137+
child: Text('标题1'),
138+
),
139+
MediaBoxDesc(
140+
child: Text("各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述"),
141+
)
142+
],
143+
),
144+
),
145+
MediaBox(
146+
child: Column(
147+
crossAxisAlignment: CrossAxisAlignment.start,
148+
children: <Widget>[
149+
MediaBoxTitle(
150+
child: Text('标题1'),
151+
),
152+
MediaBoxDesc(
153+
child: Text("各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述"),
154+
)
155+
],
156+
),
137157
),
138-
Section(
139-
children: <Widget>[
140-
H2(text: "章标题"),
141-
Section(
158+
MediaBox(
159+
child: MediaBoxAppMsg(
160+
header: Container(
161+
width: double.infinity,
162+
height: double.infinity,
163+
color: Colors.grey,
164+
),
165+
body: Column(
166+
crossAxisAlignment: CrossAxisAlignment.start,
142167
children: <Widget>[
143-
H3(
144-
text:"节标题",
168+
MediaBoxTitle(
169+
child:Text('标题1'),
145170
),
146-
P(
147-
text:
148-
'''Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo''',
171+
MediaBoxDesc(
172+
child: Text("描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述各种描述"),
149173
)
150174
],
151-
)
152-
],
175+
),
176+
)
153177
)
154178
],
155-
)
156-
],
157-
),
179+
),
180+
),
181+
WeUIApp(child:
182+
Footer(
183+
// text: "sdfsfd",
184+
links: [Link(text: "sdfds"), Link(text: "sdfsf")],
185+
),),
186+
Article(
187+
children: <Widget>[
188+
H1(
189+
text: "大标题",
190+
),
191+
Section(
192+
children: <Widget>[
193+
H2(text: "章标题"),
194+
Section(
195+
children: <Widget>[
196+
H3(
197+
text: "节标题",
198+
),
199+
P(
200+
text:
201+
'''Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo''',
202+
)
203+
],
204+
)
205+
],
206+
)
207+
],
208+
)
209+
],
158210
)
159211
],
160212
),

‎example/lib/media_box_example.dart‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎example/lib/panel_example.dart‎

Lines changed: 0 additions & 52 deletions
This file was deleted.

‎lib/src/base/color.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Color weuiLinkColorDefault(Brightness brightness) =>
3131
// background
3232
Color weuiBgColorDefault(Brightness brightness) => _themeColor(brightness,Light.WEUI_BG_0,Dark.WEUI_BG_0);
3333
Color weuiBgColorPrimary(Brightness brightness) => _themeColor(brightness,Light.WEUI_BG_1,Dark.WEUI_BG_1);
34-
34+
ColorweuiBg2(Brightness brightness) =>_themeColor(brightness,Light.WEUI_BG_2,Dark.WEUI_BG_2);
3535
// line
3636
Color weuiLineColorLight(Brightness brightness) => _themeColor(brightness,Light.WEUI_FG_3,Dark.WEUI_FG_3);
3737
Color weuiLineColorDark(Brightness brightness) => _themeColor(brightness,Light.WEUI_FG_2,Dark.WEUI_FG_2);

‎lib/src/base/theme.dart‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class WeUIThemeData extends Diagnosticable {
160160
WeUIDialogThemeData dialogTheme,
161161
Color foregroundHalf,
162162
Color toastBgColor,
163+
Color bg2,
163164
}) {
164165
brightness ??= Brightness.light;
165166
textTipsColor ??= weuiTextColorTips(brightness);
@@ -181,6 +182,7 @@ class WeUIThemeData extends Diagnosticable {
181182
dialogTheme ??= WeUIDialogThemeData(brightness: brightness);
182183
foregroundHalf ??= weuiFgHalf(brightness);
183184
toastBgColor ??= weuiToastBgColor(brightness);
185+
bg2 ??= weuiBg2(brightness);
184186
return WeUIThemeData.raw(
185187
brightness: brightness,
186188
textTipsColor: textTipsColor,
@@ -202,6 +204,7 @@ class WeUIThemeData extends Diagnosticable {
202204
dialogTheme: dialogTheme,
203205
foregroundHalf: foregroundHalf,
204206
toastBgColor: toastBgColor,
207+
bg2: bg2,
205208
);
206209
}
207210

@@ -226,6 +229,7 @@ class WeUIThemeData extends Diagnosticable {
226229
WeUIDialogThemeData dialogTheme,
227230
Color foregroundHalf,
228231
Color toastBgColor,
232+
Color bg2,
229233
}) {
230234
return WeUIThemeData.raw(
231235
brightness: brightness ?? this.brightness,
@@ -248,6 +252,7 @@ class WeUIThemeData extends Diagnosticable {
248252
dialogTheme: dialogTheme,
249253
foregroundHalf: foregroundHalf,
250254
toastBgColor: toastBgColor,
255+
bg2: bg2,
251256
);
252257
}
253258

@@ -272,6 +277,7 @@ class WeUIThemeData extends Diagnosticable {
272277
@required this.dialogTheme,
273278
@required this.foregroundHalf,
274279
@required this.toastBgColor,
280+
@required this.bg2,
275281
});
276282
final Color primaryColor;
277283
final Color warnColor;
@@ -293,6 +299,7 @@ class WeUIThemeData extends Diagnosticable {
293299
final WeUIDialogThemeData dialogTheme;
294300
final Color foregroundHalf;
295301
final Color toastBgColor;
302+
final Color bg2;
296303

297304
factory WeUIThemeData.light() => WeUIThemeData(brightness: Brightness.light);
298305

@@ -311,4 +318,4 @@ class _InheritedTheme extends InheritedWidget {
311318

312319
@override
313320
bool updateShouldNotify(_InheritedTheme old) => theme.data != old.theme.data;
314-
}
321+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /