Line data Source code
1 : import 'dart:ui';
2 :
3 : import 'package:flutter/cupertino.dart';
4 : import 'package:flutter/material.dart';
5 :
6 : import '../../convex_bottom_bar.dart';
7 : import 'blend_image_icon.dart';
8 : import 'inner_builder.dart';
9 :
10 : /// Convex shape is fixed center.
11 : class FixedTabStyle extends InnerBuilder {
12 : /// Index of the centered convex shape.
13 : final int convexIndex;
14 :
15 1 : FixedTabStyle({
16 : List<TabItem> items,
17 : Color activeColor,
18 : Color color,
19 : this.convexIndex,
20 1 : }) : super(items: items, activeColor: activeColor, color: color);
21 :
22 1 : @override
23 : Widget build(BuildContext context, int index, bool active) {
24 2 : if (index == convexIndex) {
25 3 : var item = items[convexIndex];
26 1 : return Container(
27 : height: ACTION_LAYOUT_SIZE,
28 1 : padding: EdgeInsets.only(bottom: 2),
29 1 : child: Column(
30 : mainAxisAlignment: MainAxisAlignment.end,
31 1 : children: <Widget>[
32 1 : BlendImageIcon(
33 3 : active ? item.activeIcon ?? item.icon : item.icon,
34 3 : color: item.blend ? (active ? activeColor : color) : null,
35 : size: ACTION_INNER_BUTTON_SIZE,
36 : ),
37 1 : Text(
38 1 : item.title,
39 3 : style: TextStyle(color: active ? activeColor : color),
40 : )
41 : ],
42 : ),
43 : );
44 : }
45 2 : var item = items[index];
46 1 : return Container(
47 1 : padding: EdgeInsets.only(bottom: 2),
48 1 : child: Column(
49 : mainAxisAlignment: MainAxisAlignment.end,
50 1 : children: <Widget>[
51 1 : BlendImageIcon(
52 3 : active ? item.activeIcon ?? item.icon : item.icon,
53 3 : color: item.blend ? (active ? activeColor : color) : null,
54 : ),
55 1 : Text(
56 1 : item.title,
57 3 : style: TextStyle(color: active ? activeColor : color),
58 : )
59 : ],
60 : ),
61 : );
62 : }
63 :
64 1 : @override
65 : bool fixed() {
66 : return true;
67 : }
68 : }
|