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 : /// Create style builder.
16 1 : FixedTabStyle({
17 : List<TabItem> items,
18 : Color activeColor,
19 : Color color,
20 : this.convexIndex,
21 1 : }) : super(items: items, activeColor: activeColor, color: color);
22 :
23 1 : @override
24 : Widget build(BuildContext context, int index, bool active) {
25 2 : if (index == convexIndex) {
26 3 : var item = items[convexIndex];
27 1 : return Container(
28 : height: ACTION_LAYOUT_SIZE,
29 1 : padding: EdgeInsets.only(bottom: 2),
30 1 : child: Column(
31 : mainAxisAlignment: MainAxisAlignment.end,
32 1 : children: <Widget>[
33 1 : BlendImageIcon(
34 3 : active ? item.activeIcon ?? item.icon : item.icon,
35 3 : color: item.blend ? (active ? activeColor : color) : null,
36 : size: ACTION_INNER_BUTTON_SIZE,
37 : ),
38 1 : Text(
39 1 : item.title,
40 3 : style: TextStyle(color: active ? activeColor : color),
41 : )
42 : ],
43 : ),
44 : );
45 : }
46 2 : var item = items[index];
47 1 : return Container(
48 1 : padding: EdgeInsets.only(bottom: 2),
49 1 : child: Column(
50 : mainAxisAlignment: MainAxisAlignment.end,
51 1 : children: <Widget>[
52 1 : BlendImageIcon(
53 3 : active ? item.activeIcon ?? item.icon : item.icon,
54 3 : color: item.blend ? (active ? activeColor : color) : null,
55 : ),
56 1 : Text(
57 1 : item.title,
58 3 : style: TextStyle(color: active ? activeColor : color),
59 : )
60 : ],
61 : ),
62 : );
63 : }
64 :
65 1 : @override
66 : bool fixed() {
67 : return true;
68 : }
69 : }
|