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 icon, text animated with pop transition.
10 : class TextInTabStyle extends InnerBuilder {
11 : /// Curve for tab transition.
12 : final Curve curve;
13 :
14 : /// Create style builder.
15 1 : TextInTabStyle({
16 : List<TabItem> items,
17 : Color activeColor,
18 : Color color,
19 : this.curve,
20 1 : }) : super(items: items, activeColor: activeColor, color: color);
21 :
22 1 : @override
23 : Widget build(BuildContext context, int index, bool active) {
24 2 : var item = items[index];
25 : if (active) {
26 1 : return Container(
27 : height: ACTION_LAYOUT_SIZE,
28 : padding: const EdgeInsets.only(bottom: 2),
29 1 : child: Column(
30 : mainAxisAlignment: MainAxisAlignment.end,
31 1 : children: <Widget>[
32 1 : TransitionContainer.scale(
33 1 : child: BlendImageIcon(
34 2 : item.activeIcon ?? item.icon,
35 2 : color: item.blend ? activeColor : null,
36 : size: ACTION_INNER_BUTTON_SIZE,
37 : ),
38 1 : curve: curve,
39 : ),
40 1 : TransitionContainer.slide(
41 4 : child: Text(item.title, style: TextStyle(color: activeColor)),
42 1 : curve: curve,
43 : ),
44 : ],
45 : ),
46 : );
47 : }
48 :
49 1 : return Center(
50 4 : child: BlendImageIcon(item.icon, color: item.blend ? color : null),
51 : );
52 : }
53 : }
|