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 : 9 : /// Convex shape is fixed center with circle 10 : class FixedCircleTabStyle extends DelegateBuilder { 11 : final List<TabItem> items; 12 : final Color activeColor; 13 : final Color color; 14 : final Color backgroundColor; 15 : final int convexIndex; 16 : final margin = (ACTION_LAYOUT_SIZE - ACTION_INNER_BUTTON_SIZE) / 4; 17 : 18 1 : FixedCircleTabStyle( 19 : {this.items, 20 : this.activeColor, 21 : this.color, 22 : this.backgroundColor, 23 : this.convexIndex}); 24 : 25 1 : @override 26 : Widget build(BuildContext context, int index, bool active) { 27 2 : if (index == convexIndex) { 28 2 : final item = items[index]; 29 1 : return Container( 30 1 : decoration: BoxDecoration( 31 : shape: BoxShape.circle, 32 1 : color: active ? activeColor : color, 33 : ), 34 : width: ACTION_LAYOUT_SIZE, 35 : height: ACTION_LAYOUT_SIZE, 36 2 : margin: EdgeInsets.all(margin), 37 1 : child: BlendImageIcon( 38 2 : active ? item.activeIcon ?? item.icon : item.icon, 39 : size: ACTION_INNER_BUTTON_SIZE, 40 2 : color: item.blend ? backgroundColor : null, 41 : ), 42 : ); 43 : } 44 2 : var item = items[index]; 45 1 : return Container( 46 1 : padding: EdgeInsets.only(bottom: 2), 47 1 : child: Column( 48 : mainAxisAlignment: MainAxisAlignment.end, 49 1 : children: <Widget>[ 50 1 : BlendImageIcon( 51 1 : active ? item.activeIcon ?? item.icon : item.icon, 52 2 : color: item.blend ? (active ? activeColor : color) : null, 53 : ), 54 1 : Text( 55 1 : item.title, 56 2 : style: TextStyle(color: active ? activeColor : color), 57 : ) 58 : ], 59 : ), 60 : ); 61 : } 62 : 63 1 : @override 64 : bool fixed() { 65 : return true; 66 : } 67 : }