@@ -2,11 +2,12 @@ import 'package:flutter/material.dart';
22import 'package:neptunes_pride_agent_mobile/preferences.dart' ;
33
44enum _BarButtonData {
5- refresh ("Refresh" , Icons .refresh, "NPAM:refresh" , true ),
6- colours ("Colours" , Icons .palette, "ctrl+a" , true ),
7- timebase ("Timebase" , Icons .schedule, "%" , false ),
5+ refresh (" Refresh " , Icons .refresh, "NPAM:refresh" , true ),
6+ colours (" Colours " , Icons .palette, "ctrl+a" , true ),
7+ timebase (" Timebase " , Icons .schedule, "%" , false ),
88 //settings("Settings", Icons.settings, "NPAM:settings", true),
9- npasettings ("NPA Options" , Icons .settings_applications, "ctrl+`" , true ),
9+ npasettings (" NPA Options " , Icons .settings_applications, "ctrl+`" , true ),
10+ //npamlabels(" Show button Labels ", Icons.label, "NPAM:showlabel", true),
1011 ;
1112
1213 const _BarButtonData (this .label, this .iconData, this .hotkey, this .closeMenu);
@@ -39,6 +40,7 @@ class BottomBarSettings {
3940 _BarButtonData .refresh,
4041 _BarButtonData .colours,
4142 _BarButtonData .timebase,
43+ //_BarButtonData.npamlabels,
4244 ];
4345 }
4446
@@ -49,18 +51,21 @@ class BottomBarSettings {
4951 double _maxSize = 0.0 ;
5052 double get maxSize => _maxSize;
5153
52- List <Widget > getNavItems (OnClickCallback onClick) {
54+ double _spacingSize = 5.0 ;
55+ double get spacingSize => _spacingSize;
56+
57+ List <Widget > getNavItems (OnClickCallback onClick, BuildContext context) {
5358 if (_buttons.isEmpty) {
5459 _getButtonData ();
5560 }
5661 List <Widget > items = [];
5762
5863 //if (!_buttons.contains(_BarButtonData.settings)) _buttons.insert(0, _BarButtonData.settings);
5964
60- for ( _BarButtonData data in _buttons) {
61- Size labelSize = _textSize (data.label, _textStyle);
62- if (labelSize.width > _maxSize) _maxSize = labelSize.width ;
63- }
65+ double width = MediaQuery . sizeOf (context).width;
66+ //todo: How do I deal with a dynamic margin size? Maybe?
67+ width = (width - ((_buttons.length + 1 ) * _spacingSize)) / _buttons.length ;
68+ _maxSize = width;
6469
6570 for (_BarButtonData data in _buttons) {
6671 items.add (
@@ -79,15 +84,21 @@ class BottomBarSettings {
7984 return Column (
8085 mainAxisAlignment: MainAxisAlignment .center,
8186 children: [
82- Icon (
83- data.iconData,
84- color: _iconColor,
87+ FittedBox (
88+ fit: BoxFit .contain,
89+ child: Icon (
90+ data.iconData,
91+ color: _iconColor,
92+ ),
8593 ),
8694 if (value)
87- Text (
88- data.label,
89- style: _textStyle,
90- ),
95+ FittedBox (
96+ fit: BoxFit .contain,
97+ child: Text (
98+ data.label,
99+ style: _textStyle,
100+ ),
101+ )
91102 ],
92103 );
93104 }),
0 commit comments