Skip to content

Commit a444a0b

Browse files
committed
fix(panel): fixed an exception that occurred when the title attribute was empty
1 parent e0fd2be commit a444a0b

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

example/lib/panel_example.dart

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_weui/flutter_weui.dart';
3+
4+
class MediaBoxExample extends StatelessWidget {
5+
@override
6+
Widget build(BuildContext context) {
7+
return Scaffold(
8+
appBar: AppBar(
9+
title: Text("Cell"),
10+
),
11+
body: Cells(
12+
children: <Widget>[
13+
MediaBox(
14+
title: "Title",
15+
desc: "desc",
16+
),
17+
MediaBox(
18+
thumb: Container(
19+
width: 24,
20+
height: 24,
21+
color: Colors.red,
22+
child: Text("A"),
23+
),
24+
title: "Title",
25+
desc: "desc",
26+
),
27+
MediaBox(
28+
title: "Title",
29+
desc: "desc",
30+
info: Info(children: <Widget>[
31+
Meta(text: "文字来源",),
32+
Meta(text: "文本来源",),
33+
MetaExtra(text: "其他信息",)
34+
],),
35+
)
36+
],
37+
),
38+
);
39+
}
40+
}

lib/panel.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Panel extends StatelessWidget {
1919
Offstage(
2020
child: Container(
2121
padding: const EdgeInsets.only(top: 14, right: 15, bottom: 10, left: 15),
22-
child: Text(title, style: titleStyle),
22+
child: Text(title??"", style: titleStyle),
2323
),
2424
offstage: title == null,
2525
),

0 commit comments

Comments
 (0)