Skip to content

Commit d65734a

Browse files
committed
✨ 更新绘制集录
1 parent af13bac commit d65734a

File tree

12 files changed

+269
-175
lines changed

12 files changed

+269
-175
lines changed

assets/iconfont/iconfont.ttf

-136 Bytes
Binary file not shown.

assets/images/anim_draw.webp

8.01 KB
Loading

assets/images/base_draw.webp

3.48 KB
Loading

assets/images/draw_bg3.webp

7.5 KB
Loading

assets/images/draw_bg4.webp

9.27 KB
Loading

lib/app/res/size_unit.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,14 @@ class SizeUnit {
2323

2424
// 大文字大小
2525
static const double big_text_size = 22;
26+
27+
//底栏图标大小
28+
static const double default_bottom_nav_icon = 24;
29+
static const double active_bottom_nav_icon = 29;
30+
31+
//底栏高
32+
static const double bottom_nav_height = 50;
33+
static const double bottom_nav_right_width = 120;
34+
35+
2636
}

lib/app/res/toly_icon.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import 'package:flutter/widgets.dart';
44
class TolyIcon {
55

66
TolyIcon._();
7+
static const IconData dingzhi1 = const IconData( 0xe60e, fontFamily: "TolyIcon");
78
static const IconData icon_collect = const IconData( 0xe672, fontFamily: "TolyIcon");
8-
static const IconData kujialeqiyezhan_tiaosepan = const IconData( 0xe650, fontFamily: "TolyIcon");
99
static const IconData yonghu = const IconData( 0xe619, fontFamily: "TolyIcon");
1010
static const IconData icon_common = const IconData( 0xe634, fontFamily: "TolyIcon");
1111
static const IconData icon_see = const IconData( 0xe608, fontFamily: "TolyIcon");

lib/components/permanent/feedback_widget.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class _FeedBackState extends State<FeedbackWidget>
6161
@override
6262
Widget build(BuildContext context) {
6363
return GestureDetector(
64+
behavior: HitTestBehavior.opaque,
6465
onLongPress: widget.onLongPressed,
6566
onTap: () {
6667
_controller.forward();
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import 'package:flutter/material.dart';
2+
3+
/// create by 张风捷特烈 on 2020/11/28
4+
/// contact me by email [email protected]
5+
/// 说明:
6+
7+
class GalleryCardItem extends StatelessWidget {
8+
final GalleryInfo galleryInfo;
9+
10+
GalleryCardItem({Key key, this.galleryInfo}) : super(key: key);
11+
12+
@override
13+
Widget build(BuildContext context) {
14+
return Card(
15+
shape: RoundedRectangleBorder(
16+
// side: BorderSide(width: 1.0, color: Colors.black),
17+
borderRadius: BorderRadius.all(Radius.circular(20))),
18+
child: Container(
19+
height: double.maxFinite,
20+
alignment: Alignment.topCenter,
21+
child: Column(
22+
children: [
23+
Container(
24+
height: 160,
25+
decoration: BoxDecoration(
26+
image: DecorationImage(
27+
fit: BoxFit.cover,
28+
image: AssetImage(galleryInfo.image)),
29+
color: Colors.green,
30+
borderRadius: BorderRadius.only(
31+
topLeft: Radius.circular(20),
32+
topRight: Radius.circular(20),
33+
))
34+
// color: Colors.green,
35+
36+
),
37+
Align(
38+
alignment: Alignment.topLeft,
39+
child: Padding(
40+
padding: const EdgeInsets.only(left: 15, top: 15),
41+
child: Wrap(
42+
children: [
43+
Text(
44+
galleryInfo.name,
45+
style: TextStyle(fontSize: 20),
46+
)
47+
],
48+
),
49+
),
50+
)
51+
],
52+
),
53+
decoration: BoxDecoration(
54+
color: Colors.white,
55+
borderRadius: BorderRadius.all(
56+
Radius.circular(20),
57+
))),
58+
);
59+
}
60+
}
61+
62+
class GalleryInfo {
63+
final int count;
64+
final String name;
65+
final String info;
66+
final String image;
67+
final String router;
68+
69+
const GalleryInfo(
70+
{this.count = 0, this.name, this.info, this.image, this.router});
71+
72+
factory GalleryInfo.fromJson(Map<String, dynamic> map) {
73+
return GalleryInfo(
74+
count: map['count'] ?? 0,
75+
name: map["name"] ?? "",
76+
image: map["image"] ?? "assets/images/draw_bg4.webp",
77+
router: map["router"] ?? "",
78+
info: map["info"] ?? "");
79+
}
80+
}

lib/views/pages/app/navigation/unit_bottom_bar.dart

Lines changed: 108 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_unit/app/res/size_unit.dart';
23
import 'package:flutter_unit/app/res/toly_icon.dart';
34
import 'package:flutter_unit/components/permanent/feedback_widget.dart';
45

@@ -8,12 +9,10 @@ import 'package:flutter_unit/components/permanent/feedback_widget.dart';
89
910
class UnitBottomBar extends StatefulWidget {
1011
final Color color;
11-
final Map<String, IconData> itemData;
1212
final Function(int) onItemClick;
1313

1414
UnitBottomBar(
1515
{this.color = Colors.blue,
16-
@required this.itemData,
1716
@required this.onItemClick});
1817

1918
@override
@@ -25,6 +24,16 @@ class _UnitBottomBarState extends State<UnitBottomBar> {
2524

2625
final NotchedShape shape = const CircularNotchedRectangle();
2726

27+
final borderTR = const BorderRadius.only(
28+
topRight: Radius.circular(10),
29+
);
30+
31+
final borderTL = const BorderRadius.only(topLeft: Radius.circular(10));
32+
final paddingTR = const EdgeInsets.only(top: 2, right: 2);
33+
final paddingTL = const EdgeInsets.only(top: 2, left: 2);
34+
final paddingL = const EdgeInsets.only(left: 8);
35+
final paddingR = const EdgeInsets.only(right: 8);
36+
2837
@override
2938
Widget build(BuildContext context) {
3039
return BottomAppBar(
@@ -36,117 +45,117 @@ class _UnitBottomBarState extends State<UnitBottomBar> {
3645
data: IconTheme.of(context).copyWith(color: Colors.white, size: 25),
3746
child: Stack(
3847
children: [
39-
Material(
40-
elevation: 0,
41-
shape: RoundedRectangleBorder(borderRadius: borderTR),
42-
child: Container(
43-
margin: paddingTR,
44-
alignment: Alignment.center,
45-
decoration: BoxDecoration(
46-
color: widget.color.withAlpha(88),
47-
borderRadius: borderTR),
48-
height: 50,
49-
width: 120,
50-
child: Row(
51-
mainAxisAlignment: MainAxisAlignment.center,
52-
children: [
53-
FeedbackWidget(
54-
onPressed: () => _updateIndex(0),
55-
onLongPressed: () => _onLongPress(context, 0),
56-
child: Container(
57-
width: 50,
58-
height: 50,
59-
child: Icon(
60-
TolyIcon.icon_layout,
61-
size: _position == 0 ? 28 : 25,
62-
color:
63-
_position == 0 ? widget.color : Colors.white,
64-
)),
65-
),
66-
FeedbackWidget(
67-
onPressed: () => _updateIndex(1),
68-
child: Container(
69-
width: 50,
70-
height: 50,
71-
child: Icon(
72-
TolyIcon.kujialeqiyezhan_tiaosepan,
73-
size: _position == 1 ? 28 : 25,
74-
color:
75-
_position == 1 ? widget.color : Colors.white,
76-
)),
77-
),
78-
],
79-
),
80-
),
81-
),
48+
_buildLeftBtn(context),
8249
Positioned(
8350
right: 0,
84-
child: Material(
85-
elevation: 0,
86-
shape: RoundedRectangleBorder(borderRadius: borderTL),
87-
child: Container(
88-
margin: paddingTL,
89-
alignment: Alignment.center,
90-
decoration: BoxDecoration(
91-
color: widget.color.withAlpha(88),
92-
borderRadius: borderTL),
93-
height: 50,
94-
width: 120,
95-
child: Row(
96-
mainAxisAlignment: MainAxisAlignment.center,
97-
children: [
98-
FeedbackWidget(
99-
onPressed: () => _updateIndex(2),
100-
child: Container(
101-
width: 50,
102-
height: 50,
103-
child: Icon(
104-
TolyIcon.icon_collect,
105-
size: _position == 2 ? 28 : 25,
106-
color: _position == 2
107-
? widget.color
108-
: Colors.white,
109-
)),
110-
),
111-
FeedbackWidget(
112-
onPressed: () => _updateIndex(3),
113-
onLongPressed: () => _onLongPress(context, 1),
114-
child: Container(
115-
width: 50,
116-
height: 50,
117-
child: Icon(
118-
TolyIcon.yonghu,
119-
size: _position == 3 ? 28 : 25,
120-
color: _position == 3
121-
? widget.color
122-
: Colors.white,
123-
)),
124-
),
125-
],
126-
),
127-
),
128-
),
51+
child: _buildRightBtn(context),
12952
),
13053
],
13154
),
13255
));
13356
}
13457

58+
Widget _buildLeftBtn(BuildContext context) => Material(
59+
shape: RoundedRectangleBorder(borderRadius: borderTR),
60+
child: Container(
61+
margin: paddingTR,
62+
alignment: Alignment.center,
63+
decoration: BoxDecoration(
64+
color: widget.color.withAlpha(88), borderRadius: borderTR),
65+
height: SizeUnit.bottom_nav_height,
66+
width: SizeUnit.bottom_nav_right_width,
67+
child: Row(
68+
mainAxisAlignment: MainAxisAlignment.center,
69+
children: [
70+
Expanded(
71+
child: FeedbackWidget(
72+
onPressed: () => _updateIndex(0),
73+
onLongPressed: () => _onLongPress(context, 0),
74+
child: Container(
75+
padding: paddingL,
76+
height: SizeUnit.bottom_nav_height,
77+
child: Icon(
78+
TolyIcon.icon_layout,
79+
size: iconSize(0),
80+
color: iconColor(0),
81+
)),
82+
),
83+
),
84+
Expanded(
85+
child: FeedbackWidget(
86+
onPressed: () => _updateIndex(1),
87+
child: Container(
88+
height: SizeUnit.bottom_nav_height,
89+
padding: paddingR,
90+
child: Icon(
91+
TolyIcon.dingzhi1,
92+
size: iconSize(1),
93+
color: iconColor(1),
94+
)),
95+
),
96+
),
97+
],
98+
),
99+
),
100+
);
101+
102+
Widget _buildRightBtn(BuildContext context) => Material(
103+
shape: RoundedRectangleBorder(borderRadius: borderTL),
104+
child: Container(
105+
margin: paddingTL,
106+
alignment: Alignment.center,
107+
decoration: BoxDecoration(
108+
color: widget.color.withAlpha(88), borderRadius: borderTL),
109+
height: SizeUnit.bottom_nav_height,
110+
width: SizeUnit.bottom_nav_right_width,
111+
child: Row(
112+
mainAxisAlignment: MainAxisAlignment.center,
113+
children: [
114+
Expanded(
115+
child: FeedbackWidget(
116+
onPressed: () => _updateIndex(2),
117+
child: Container(
118+
padding: paddingL,
119+
height: SizeUnit.bottom_nav_height,
120+
child: Icon(
121+
TolyIcon.icon_collect,
122+
size: iconSize(2),
123+
color: iconColor(2),
124+
)),
125+
),
126+
),
127+
Expanded(
128+
child: FeedbackWidget(
129+
onPressed: () => _updateIndex(3),
130+
onLongPressed: () => _onLongPress(context, 1),
131+
child: Container(
132+
padding: paddingR,
133+
height: SizeUnit.bottom_nav_height,
134+
child: Icon(
135+
TolyIcon.yonghu,
136+
size: iconSize(3),
137+
color: iconColor(3),
138+
)),
139+
),
140+
),
141+
],
142+
),
143+
),
144+
);
145+
146+
double iconSize(int position) => _position == position
147+
? SizeUnit.active_bottom_nav_icon
148+
: SizeUnit.default_bottom_nav_icon;
149+
150+
Color iconColor(int position) =>
151+
_position == position ? widget.color : Colors.white;
152+
135153
void _updateIndex(int index) {
136154
setState(() {
137155
_position = index;
138156
widget.onItemClick(_position);
139157
});
140158
}
141-
142-
List<String> get info => widget.itemData.keys.toList();
143-
144-
final borderTR = const BorderRadius.only(
145-
topRight: Radius.circular(10),
146-
);
147-
final borderTL = const BorderRadius.only(topLeft: Radius.circular(10));
148-
final paddingTR = const EdgeInsets.only(top: 2, right: 2);
149-
final paddingTL = const EdgeInsets.only(top: 2, left: 2);
150159
}
151160

152161
_onLongPress(BuildContext context, int i) {

0 commit comments

Comments
 (0)