Line data Source code
1 : import 'package:flutter/cupertino.dart';
2 : import 'package:flutter/material.dart';
3 :
4 : import '../../convex_bottom_bar.dart';
5 : import 'blend_image_icon.dart';
6 : import 'inner_builder.dart';
7 : import 'transition_container.dart';
8 :
9 : /// Tab item are flipped when click.
10 : class FlipTabStyle extends InnerBuilder {
11 : /// Curve for flip transition.
12 : final Curve curve;
13 :
14 1 : FlipTabStyle({
15 : List<TabItem> items,
16 : Color activeColor,
17 : Color color,
18 : this.curve,
19 1 : }) : super(items: items, activeColor: activeColor, color: color);
20 :
21 1 : @override
22 : Widget build(BuildContext context, int index, bool active) {
23 2 : var item = items[index];
24 : if (active) {
25 1 : return TransitionContainer.flip(
26 1 : duration: Duration(milliseconds: 500),
27 : height: ACTION_LAYOUT_SIZE,
28 1 : bottomChild: Container(
29 1 : padding: EdgeInsets.only(bottom: 2),
30 1 : child: Column(
31 : mainAxisAlignment: MainAxisAlignment.end,
32 1 : children: <Widget>[
33 1 : BlendImageIcon(
34 2 : item.activeIcon ?? item.icon,
35 2 : color: item.blend ? activeColor : null,
36 : size: ACTION_INNER_BUTTON_SIZE,
37 : ),
38 4 : Text(item.title, style: TextStyle(color: activeColor))
39 : ],
40 : ),
41 : ),
42 1 : topChild: Container(
43 : height: BAR_HEIGHT,
44 1 : child: Center(
45 4 : child: BlendImageIcon(item.icon, color: item.blend ? color : null),
46 : ),
47 : ),
48 1 : curve: curve,
49 : );
50 : }
51 1 : return Center(
52 4 : child: BlendImageIcon(item.icon, color: item.blend ? color : null),
53 : );
54 : }
55 : }
|