Skip to content

Commit 78930d6

Browse files
committed
feat(MediaBox): add MediaBox widget
1 parent 89f57bc commit 78930d6

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

lib/flutter_weui.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ export 'weui_icon.dart';
1111
export 'load_more.dart';
1212
export 'dialog.dart';
1313
export 'touchable.dart';
14+
export 'media_box.dart';

lib/media_box.dart

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import 'package:flutter/material.dart';
2+
import 'touchable.dart';
3+
4+
class Info extends StatelessWidget {
5+
Info({Key key, this.children}) : super(key: key);
6+
final List<Widget> children;
7+
@override
8+
Widget build(BuildContext context) {
9+
return Padding(
10+
padding: const EdgeInsets.only(top: 10),
11+
child: Row(
12+
children: children,
13+
),
14+
);
15+
}
16+
}
17+
18+
class Meta extends StatelessWidget {
19+
Meta({Key key, this.text}) : super(key: key);
20+
final String text;
21+
@override
22+
Widget build(BuildContext context) {
23+
TextStyle textStyle = TextStyle(color: Color(0xFFCECECE), fontSize: 13);
24+
return Padding(
25+
padding: const EdgeInsets.only(right: 8),
26+
child: Text(text, style: textStyle),
27+
);
28+
}
29+
}
30+
31+
class MetaExtra extends StatelessWidget {
32+
MetaExtra({Key key, this.text}) : super(key: key);
33+
final String text;
34+
@override
35+
Widget build(BuildContext context) {
36+
TextStyle textStyle = TextStyle(color: Color(0xFFCECECE), fontSize: 13);
37+
return Container(
38+
padding: const EdgeInsets.only(left: 8),
39+
decoration: BoxDecoration(border: Border(left: BorderSide(color: const Color(0xffcecece)))),
40+
child: Text(text, style: textStyle),
41+
);
42+
}
43+
}
44+
45+
class MediaBox extends StatelessWidget {
46+
MediaBox({Key key, this.thumb, this.title = "", this.desc = "", this.info}) : super(key: key);
47+
final Widget thumb;
48+
final String title;
49+
final String desc;
50+
final Info info;
51+
52+
@override
53+
Widget build(BuildContext context) {
54+
TextStyle titleStyle = TextStyle(fontSize: 17, fontWeight: FontWeight.w400, color: Colors.black);
55+
TextStyle descStyle = TextStyle(fontSize: 13, color: Color(0xFF808080));
56+
return TouchableHighlight(
57+
child: Container(
58+
padding: const EdgeInsets.all(15),
59+
child: Column(
60+
children: <Widget>[
61+
Row(
62+
children: <Widget>[
63+
Offstage(
64+
child: Container(
65+
height: 60,
66+
width: 60,
67+
margin: const EdgeInsets.only(right: 10),
68+
child: thumb,
69+
),
70+
offstage: thumb == null,
71+
),
72+
Expanded(
73+
child: Column(
74+
crossAxisAlignment: CrossAxisAlignment.start,
75+
children: <Widget>[Text(title, style: titleStyle), Text(desc, style: descStyle)],
76+
),
77+
)
78+
],
79+
),
80+
Offstage(
81+
child: info,
82+
offstage: info == null,
83+
)
84+
],
85+
),
86+
),
87+
);
88+
}
89+
}

0 commit comments

Comments
 (0)