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