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 : /// Convex shape is moved after selection.
10 : class ReactTabStyle extends InnerBuilder {
11 : /// Curve for tab transition.
12 : final Curve curve;
13 :
14 1 : ReactTabStyle({
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 Container(
26 : height: ACTION_LAYOUT_SIZE,
27 : padding: const EdgeInsets.only(bottom: 2),
28 1 : child: Column(
29 : mainAxisAlignment: MainAxisAlignment.end,
30 1 : children: <Widget>[
31 1 : TransitionContainer.scale(
32 1 : child: BlendImageIcon(
33 2 : item.activeIcon ?? item.icon,
34 2 : color: item.blend ? activeColor : null,
35 : size: ACTION_INNER_BUTTON_SIZE,
36 : ),
37 1 : curve: curve,
38 : ),
39 4 : Text(item.title, style: TextStyle(color: activeColor))
40 : ],
41 : ),
42 : );
43 : }
44 1 : return Container(
45 : height: BAR_HEIGHT,
46 : padding: const EdgeInsets.only(bottom: 2),
47 1 : child: Column(
48 : mainAxisAlignment: MainAxisAlignment.end,
49 1 : children: <Widget>[
50 4 : BlendImageIcon(item.icon, color: item.blend ? color : null),
51 4 : Text(item.title, style: TextStyle(color: color))
52 : ],
53 : ),
54 : );
55 : }
56 : }
|