Skip to content

Commit fc84531

Browse files
committed
🚑 hero组件异常
1 parent 548199c commit fc84531

File tree

16 files changed

+152
-239
lines changed

16 files changed

+152
-239
lines changed

lib/components/permanent/circle.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Circle extends StatelessWidget {
66
final bool showShadow;
77
final Widget child;
88

9-
Circle({this.color=Colors.blue, this.radius=6,this.showShadow=true,this.child});
9+
const Circle({this.color=Colors.blue, this.radius=6,this.showShadow=true,this.child});
1010

1111
@override
1212
Widget build(BuildContext context) {

lib/components/permanent/tag.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Tag extends StatelessWidget {
66
final double tranRate;
77
final Color color;
88

9-
Tag({this.size = const Size(100, 150),this.shadowHeight=9.0,this.tranRate=0.25,this.color=Colors.red});
9+
const Tag({this.size = const Size(100, 150),this.shadowHeight=9.0,this.tranRate=0.25,this.color=Colors.red});
1010

1111
@override
1212
Widget build(BuildContext context) {

lib/views/app/navigation/unit_bottom_bar.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class _UnitBottomBarState extends State<UnitBottomBar> {
2525
Widget build(BuildContext context) {
2626
return BottomAppBar(
2727
elevation: 0,
28-
shape: CircularNotchedRectangle(),
28+
shape: const CircularNotchedRectangle(),
2929
notchMargin: 5,
3030
color: widget.color,
3131
child: Row(
@@ -38,28 +38,27 @@ class _UnitBottomBarState extends State<UnitBottomBar> {
3838

3939
List<String> get info => widget.itemData.keys.toList();
4040

41+
final borderTR = const BorderRadius.only(topRight: Radius.circular(10));
42+
final borderTL = const BorderRadius.only(topLeft: Radius.circular(10));
43+
final paddingTR = const EdgeInsets.only(top: 2, right: 2);
44+
final paddingTL = const EdgeInsets.only(top: 2, left: 2);
45+
4146
Widget _buildChild(BuildContext context, int i, Color color) {
4247
var active = i == _position;
4348
bool left = i == 0;
49+
4450
return GestureDetector(
4551
onTap: () => _tapTab(i),
4652
onLongPress: () => _onLongPress(context, i),
4753
child: Material(
4854
elevation: 2,
49-
shape: RoundedRectangleBorder(
50-
borderRadius: left
51-
? BorderRadius.only(topRight: Radius.circular(10))
52-
: BorderRadius.only(topLeft: Radius.circular(10))),
55+
shape: RoundedRectangleBorder(borderRadius: left ? borderTR : borderTL),
5356
child: Container(
54-
margin: left
55-
? EdgeInsets.only(top: 2, right: 2)
56-
: EdgeInsets.only(top: 2, left: 2),
57+
margin: left ? paddingTR : paddingTL,
5758
alignment: Alignment.center,
5859
decoration: BoxDecoration(
5960
color: color.withAlpha(88),
60-
borderRadius: left
61-
? BorderRadius.only(topRight: Radius.circular(10))
62-
: BorderRadius.only(topLeft: Radius.circular(10))),
61+
borderRadius: left ? borderTR : borderTL),
6362
height: 45,
6463
width: 100,
6564
child: Icon(

lib/views/app/navigation/unit_navigation.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _UnitNavigationState extends State<UnitNavigation> {
4242
FloatingActionButtonLocation.centerDocked,
4343
floatingActionButton: _buildSearchButton(state.homeColor),
4444
body: PageView(
45-
physics: NeverScrollableScrollPhysics(),
45+
physics:const NeverScrollableScrollPhysics(),
4646
//使用PageView实现页面的切换
4747
controller: _controller,
4848
children: <Widget>[
@@ -60,14 +60,14 @@ class _UnitNavigationState extends State<UnitNavigation> {
6060
return FloatingActionButton(
6161
elevation: 2,
6262
backgroundColor: color,
63-
child: Icon(Icons.search),
63+
child: const Icon(Icons.search),
6464
onPressed: () => Navigator.of(context).pushNamed(Router.search),
6565
);
6666
}
6767

6868
_onTapNav(int index) {
6969
_controller.animateToPage(index,
70-
duration: Duration(milliseconds: 200), curve: Curves.linear);
70+
duration:const Duration(milliseconds: 200), curve: Curves.linear);
7171
if (index == 1) {
7272
BlocProvider.of<CollectBloc>(context).add(EventSetCollectData());
7373
}

lib/views/app/splash/unit_splash.dart

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,14 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
2424
AnimationController _controller;
2525
AnimationController _secondController;
2626
double _factor;
27-
double _secondFactor = 0.0;
2827
Animation _curveAnim;
29-
Animation _curveAnim2;
30-
Animation _bouncAnim;
28+
3129
bool _animEnd = false;
3230

3331
@override
3432
void initState() {
35-
// SystemUiOverlayStyle systemUiOverlayStyle =
36-
// SystemUiOverlayStyle(statusBarColor: Colors.red);
37-
// SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
38-
// SystemChrome.setSystemUIOverlayStyle(
39-
// SystemUiOverlayStyle(statusBarColor: Colors.blue));
40-
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
41-
// systemNavigationBarColor: Colors.transparent,
42-
statusBarColor: Colors.transparent);
33+
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor: Colors.transparent);
4334
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
44-
// SystemChrome.setEnabledSystemUIOverlays([]);
4535

4636
_controller =
4737
AnimationController(duration: Duration(milliseconds: 1000), vsync: this)
@@ -58,18 +48,13 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
5848
});
5949
_secondController =
6050
AnimationController(duration: Duration(milliseconds: 600), vsync: this)
61-
..addListener(() => setState(() {
62-
return _secondFactor = _curveAnim2.value;
63-
}))
6451
..addStatusListener((s) {
6552
if (s == AnimationStatus.completed) {
6653
Navigator.of(context).pushReplacementNamed(Router.nav);
6754
}
6855
});
6956
_curveAnim =
7057
CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn);
71-
_curveAnim2 =
72-
CurvedAnimation(parent: _secondController, curve: Curves.fastOutSlowIn);
7358
_controller.forward();
7459
super.initState();
7560
}
@@ -79,14 +64,7 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
7964
var winH = MediaQuery.of(context).size.height;
8065
var winW = MediaQuery.of(context).size.width;
8166

82-
return
83-
// GestureDetector(
84-
// onTap: () {
85-
// _controller.reset();
86-
// _controller.forward();
87-
// },
88-
// child:
89-
Scaffold(
67+
return Scaffold(
9068
body: Stack(
9169
alignment: Alignment.center,
9270
children: <Widget>[
@@ -103,7 +81,6 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
10381
buildPower(),
10482
],
10583
),
106-
// ),
10784
);
10885
}
10986

@@ -113,8 +90,7 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
11390
color: Theme.of(context).primaryColor,
11491
fontWeight: FontWeight.bold,
11592
shadows: [
116-
Shadow(
117-
//阴影
93+
const Shadow(
11894
color: Colors.grey,
11995
offset: Offset(1.0, 1.0), blurRadius: 1.0,
12096
)
@@ -131,7 +107,7 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
131107
AlignmentTween(begin: Alignment(-1, 0), end: Alignment.center)
132108
.animate(_secondController),
133109
child: AnimatedOpacity(
134-
duration: Duration(milliseconds: 300),
110+
duration: const Duration(milliseconds: 300),
135111
opacity: _animEnd ? 1.0 : 0.0,
136112
child: ShaderMask(
137113
shaderCallback: _buildShader,
@@ -156,8 +132,8 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
156132
Widget buildLogo(Color primaryColor) {
157133
return SlideTransition(
158134
position: Tween<Offset>(
159-
begin: Offset(0, 0),
160-
end: Offset(0, -1.5),
135+
begin:const Offset(0, 0),
136+
end:const Offset(0, -1.5),
161137
).animate(_controller),
162138
child: RotationTransition(
163139
turns: _controller,
@@ -179,27 +155,24 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
179155
);
180156
}
181157

182-
Widget buildHead() {
183-
return SlideTransition(
158+
Widget buildHead() => SlideTransition(
184159
position: Tween<Offset>(
185-
end: Offset(0, 0),
186-
begin: Offset(0, -5),
160+
end:const Offset(0, 0),
161+
begin:const Offset(0, -5),
187162
).animate(_controller),
188163
child: Container(
189164
height: 45,
190165
width: 45,
191166
child: Image.asset('assets/images/icon_head.png'),
192167
));
193-
}
194168

195-
Widget buildPower() {
196-
return Positioned(
169+
Widget buildPower() => Positioned(
197170
bottom: 30,
198171
right: 30,
199172
child: AnimatedOpacity(
200-
duration: Duration(milliseconds: 300),
173+
duration:const Duration(milliseconds: 300),
201174
opacity: _animEnd ? 1.0 : 0.0,
202-
child: Text("Power By 张风捷特烈",
175+
child:const Text("Power By 张风捷特烈",
203176
style: TextStyle(
204177
color: Colors.grey,
205178
shadows: [
@@ -210,5 +183,4 @@ class _UnitSplashState extends State<UnitSplash> with TickerProviderStateMixin {
210183
],
211184
fontSize: 16))),
212185
);
213-
}
214186
}
File renamed without changes.

lib/views/items/category_list_item.dart

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class CategoryListItem extends StatelessWidget {
1919
Widget build(BuildContext context) {
2020
return Material(
2121
shadowColor: data.color.withAlpha(88),
22-
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10))),
22+
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10))),
2323
elevation: 2,
2424
child: Container(
2525
child: _buildChild(context),
26-
padding: EdgeInsets.all(10),
26+
padding: const EdgeInsets.all(10),
2727

28-
decoration: BoxDecoration(
28+
decoration:const BoxDecoration(
2929
color: Colors.white,
3030
borderRadius: BorderRadius.all(Radius.circular(10)),
3131
),
@@ -39,7 +39,7 @@ class CategoryListItem extends StatelessWidget {
3939
return Column(
4040
children: <Widget>[
4141
_buildTitle(themeColor),
42-
Divider(),
42+
const Divider(),
4343
Expanded(
4444
child: Stack(
4545
fit: StackFit.expand,
@@ -50,7 +50,7 @@ class CategoryListItem extends StatelessWidget {
5050
style: TextStyle(
5151
color: Colors.grey,
5252
shadows: [
53-
Shadow(color: themeColor, offset: Offset(.2,.2),blurRadius: .5)
53+
Shadow(color: themeColor, offset:const Offset(.2,.2),blurRadius: .5)
5454
])),
5555
),
5656
Positioned(
@@ -72,7 +72,7 @@ class CategoryListItem extends StatelessWidget {
7272
)
7373
],
7474
)),
75-
Divider(),
75+
const Divider(),
7676
Padding(
7777
padding: const EdgeInsets.all(5.0),
7878
child: Text(
@@ -107,66 +107,12 @@ class CategoryListItem extends StatelessWidget {
107107
onDeleteItemClick(data);
108108
}
109109
},
110-
child: Icon(
110+
child: const Icon(
111111
CupertinoIcons.delete_solid,
112112
color: Colors.red,
113113
),
114114
)
115115
],
116116
);
117117
}
118-
119-
// Widget _buildLeading() => Padding(
120-
// padding: const EdgeInsets.only(left: 5, right: 5),
121-
// child: data.image == null
122-
// ? Material(
123-
// color: Colors.transparent,
124-
// child: CircleText(
125-
// text: data.name,
126-
// size: 50,
127-
// color: itemColor,
128-
// ),
129-
// )
130-
// : CircleImage(
131-
// image: data.image,
132-
// size: 50,
133-
// ),
134-
// );
135-
//
136-
// Color get itemColor => Color(Cons.tabColors[data.family.index]);
137-
//
138-
// Widget _buildTitle() {
139-
// return Row(
140-
// children: <Widget>[
141-
//// SizedBox(width: 10),
142-
// Expanded(
143-
// child: Text(data.name,
144-
// overflow: TextOverflow.ellipsis,
145-
// style: TextStyle(
146-
// fontSize: 17,
147-
// fontWeight: FontWeight.bold,
148-
// shadows: [
149-
// Shadow(color: Colors.white, offset: Offset(.3, .3))
150-
// ])),
151-
// ),
152-
// ],
153-
// );
154-
// }
155-
//
156-
// Widget _buildSummary() {
157-
// return Padding(
158-
// padding: const EdgeInsets.only(left: 5, bottom: 10, top: 5),
159-
// child: Container(
160-
// child: Text(
161-
// data.nameCN,
162-
// maxLines: 2,
163-
// overflow: TextOverflow.ellipsis,
164-
// style: TextStyle(
165-
// color: Colors.grey[600],
166-
// fontSize: 14,
167-
// shadows: [Shadow(color: Colors.white, offset: Offset(.5, .5))]),
168-
// ),
169-
// ),
170-
// );
171-
// }
172118
}

0 commit comments

Comments
 (0)