Skip to content

Commit 5a7dd70

Browse files
author
pengweijun
committed
发现页部分代码
1 parent ac67692 commit 5a7dd70

File tree

4 files changed

+150
-41
lines changed

4 files changed

+150
-41
lines changed

lib/FindView.dart

Lines changed: 96 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,114 @@
11
import 'package:flutter/material.dart';
2-
class FindView extends StatefulWidget{
2+
import 'dart:ui';
3+
import 'scanVC.dart';
4+
5+
class FindView extends StatefulWidget {
36
@override
47
_FindViewState createState() => new _FindViewState();
58
}
6-
class _FindViewState extends State{
9+
10+
class _FindViewState extends State {
711
@override
8-
Container _FindCell(String iconName,String contentName,Color color,double topY) {
12+
Container _FindCell(String iconName, String contentName, Color color,
13+
double topY, double lineH) {
914
return new Container(
10-
padding:EdgeInsets.only(top:topY),
11-
child: new Container(
12-
height: 56.0,
13-
child: new ListTile(
14-
leading: new Image.asset(
15-
iconName,
16-
height: 40,
17-
width: 40,
18-
// color: color,
15+
padding: EdgeInsets.only(top: topY),
16+
color: Color.fromARGB(0xff, 0xf2, 0xf2, 0xf2),
17+
// height: 54.0 + topY + lineH ,
18+
child: new Column(
19+
children: <Widget>[
20+
Container(
21+
height: 54.0 + lineH,
22+
color: Colors.white,
23+
child: new Row(
24+
// mainAxisAlignment: MainAxisAlignment.start,
25+
children: <Widget>[
26+
Container(width: 17),
27+
new Image.asset(
28+
iconName,
29+
height: 22.0,
30+
width: 22,
31+
// color: color,
32+
),
33+
Container(width: 17),
34+
new Text(
35+
contentName,
36+
style: const TextStyle(
37+
fontSize: 17.0,
38+
fontWeight: FontWeight.w400,
39+
),
40+
)
41+
]),
42+
),
43+
Container(
44+
height: lineH,
45+
child: new Row(
46+
children: <Widget>[
47+
Container(
48+
width: 60,
49+
color: Colors.white,
50+
),
51+
Container(
52+
color: Color.fromARGB(0x7d, 0xd9, 0xd9, 0xd9),
53+
width: window.physicalSize.width / 3 - 60,
54+
)
55+
],
1956
),
20-
title: new Text(contentName),
21-
),
22-
color: Colors.white,
23-
),
24-
color: Colors.grey[200],
57+
// padding: EdgeInsets.all(100),
58+
),
59+
],
60+
),
2561
);
2662
}
2763

2864
Widget build(BuildContext context) {
2965
// TODO: implement build
3066
return new Scaffold(
31-
backgroundColor: Colors.green,
32-
body: new ListView(
67+
backgroundColor: Color.fromARGB(0xff, 0xf2, 0xf2, 0xf2),
68+
body: new ListView(
3369
children: <Widget>[
34-
_FindCell("wechatassts/ff_IconShowAlbum@3x.png", "朋友圈", Colors.red,0.0),
35-
36-
_FindCell("wechatassts/ff_IconQRCode@3x.png", "扫一扫", Colors.red,20.0),
37-
_FindCell("wechatassts/ff_IconShake@3x.png", "摇一摇", Colors.red,0),
38-
39-
_FindCell("wechatassts/ff_IconBrowse1@3x.png", "看一看", Colors.red,20.0),
40-
_FindCell("wechatassts/ff_IconSearch1@3x.png", "搜一搜", Colors.red,0),
70+
new GestureDetector(
71+
onTap: () {
72+
print("点朋友圈Cell");
73+
},
74+
child: _FindCell("wechatassts/ff_IconShowAlbum@3x.png", "朋友圈",
75+
Colors.red, 0.0, 0),
76+
),
4177

42-
_FindCell("wechatassts/ff_IconNearby@3x.png", "附近的人", Colors.red,20),
43-
_FindCell("wechatassts/ff_IconBottle@3x.png", "漂流瓶", Colors.red,0),
44-
_FindCell("wechatassts/ff_IconQRCode@3x.png", "附近的餐厅", Colors.red,0),
78+
new GestureDetector(
79+
onTap: () {
80+
print("点了扫一扫");
81+
},
82+
child: _FindCell("wechatassts/ff_IconQRCode@3x.png", "扫一扫",
83+
Colors.red, 9.0, 0.5),
84+
),
4585

46-
_FindCell("wechatassts/ff_IconQRCode@3x.png", "购物", Colors.red,20.0),
47-
_FindCell("wechatassts/GameCenterH5GameMenuBtn@2x.png", "游戏", Colors.red,0),
86+
_FindCell(
87+
"wechatassts/ff_IconShake@3x.png", "摇一摇", Colors.red, 0, 0),
88+
_FindCell("wechatassts/ff_IconBrowse1@3x.png", "看一看", Colors.red,
89+
9.0, 0.5),
90+
_FindCell(
91+
"wechatassts/ff_IconSearch1@3x.png", "搜一搜", Colors.red, 0, 0),
92+
_FindCell(
93+
"wechatassts/ff_IconNearby@3x.png", "附近的人", Colors.red, 9, 0.5),
94+
_FindCell(
95+
"wechatassts/ff_IconBottle@3x.png", "漂流瓶", Colors.red, 0, 0.5),
96+
_FindCell(
97+
"wechatassts/ff_IconQRCode@3x.png", "附近的餐厅", Colors.red, 0, 0),
98+
_FindCell(
99+
"wechatassts/ff_IconQRCode@3x.png", "购物", Colors.red, 9, 0.5),
100+
_FindCell("wechatassts/GameCenterH5GameMenuBtn@2x.png", "游戏",
101+
Colors.red, 0, 0),
102+
_FindCell("wechatassts/PaidDetail_MiniProgram@3x.png", "小程序",
103+
Colors.red, 9, 0),
48104

49-
_FindCell("wechatassts/PaidDetail_MiniProgram@3x.png", "小程序", Colors.red,20.0),
105+
// _FindCell("wechatassts/ff_IconShowAlbum@3x.png", "朋友圈", Colors.red,
106+
// 0.0, 0),
107+
// _FindCell("wechatassts/ff_IconQRCode@3x.png", "扫一扫", Colors.red,
108+
// 9.0, 0.5),
50109

51-
/*
52-
new Container(
110+
/*
111+
53112
padding:const EdgeInsets.only(top: 20.0),
54113
child: new Container(
55114
height: 50.0,
@@ -122,8 +181,7 @@ class _FindViewState extends State{
122181
color: Colors.grey[200],
123182
),
124183
*/
125-
],
126-
)
127-
);
184+
],
185+
));
128186
}
129-
}
187+
}

lib/Home.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class _HomeViewState extends State{
116116
);
117117
},
118118
leading: new Image.asset("images/a004.jpg",width: 40.0,height: 40.0,fit: BoxFit.cover,),
119-
title: new Text("老板"),
119+
title: new Text("大哒哒哒哒老板"),
120120
subtitle: new Text("【微信红包,大吉大利】"),
121121
trailing: new Text("那年今日"),
122122
),

lib/main.dart

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,30 @@ class myApp extends StatelessWidget {
2424
}
2525
}
2626

27+
class MAppBar extends StatefulWidget implements PreferredSizeWidget {
28+
MAppBar({@required this.child}) : assert(child != null);
29+
final Widget child;
30+
@override
31+
Size get preferredSize {
32+
return new Size.fromHeight(51.0);
33+
}
34+
35+
@override
36+
State createState() {
37+
return new MAppBarState();
38+
}
39+
}
40+
41+
class MAppBarState extends State<MAppBar> {
42+
@override
43+
Widget build(BuildContext context) {
44+
return new SafeArea(
45+
top: true,
46+
child: widget.child,
47+
);
48+
}
49+
}
50+
2751
class RandomWords extends StatefulWidget {
2852
@override
2953
createState() => new RandomWordsState();
@@ -74,13 +98,38 @@ class RandomWordsState extends State<RandomWords> {
7498
new FindView(),
7599
new MineView()
76100
];
77-
int _sindex = 0;
101+
int _sindex = 2;
78102
String _title = "微信";
79103

80104
@override
81105
Widget build(BuildContext context) {
82106
return new Scaffold(
83107
appBar: new AppBar(
108+
// child: new Column(
109+
// mainAxisAlignment: MainAxisAlignment.center,
110+
// children: <Widget>[
111+
// Container(
112+
// height: 13,
113+
// color: Color.fromARGB(0xff, 0xf2, 0xf2, 0xf2),
114+
// ),
115+
// Container(
116+
// width: 1000,
117+
// color: Color.fromARGB(0xff, 0xf2, 0xf2, 0xf2),
118+
// child: new Text(
119+
// "发现",
120+
// style: TextStyle(
121+
// color: Colors.black,
122+
// fontSize: 17,
123+
// fontWeight: FontWeight.w500,
124+
// ),
125+
// textAlign: TextAlign.center,
126+
// ),
127+
// ),
128+
// Container(
129+
// height: 14, color: Color.fromARGB(0xff, 0xf2, 0xf2, 0xf2)),
130+
// ],
131+
// ),
132+
84133
backgroundColor: Color.fromARGB(0xff, 0xf2, 0xf2, 0xf2),
85134
elevation: 0.0,
86135
title: new Text(_title),
@@ -89,7 +138,7 @@ class RandomWordsState extends State<RandomWords> {
89138
icon: new Icon(Icons.list),
90139

91140
onPressed: () {
92-
print("点击了");
141+
print("点击了-index");
93142
},
94143
),
95144
],

lib/scanVC.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import 'package:flutter/material.dart';
2+

0 commit comments

Comments
 (0)