-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added padding between role filter checkboxes,
reduced padding in group headers split the combat group header components into their own classes
- Loading branch information
Showing
14 changed files
with
391 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
lib/screens/roster/combatGroup/combat_group_options_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gearforce/models/combatGroups/combat_group.dart'; | ||
import 'package:gearforce/models/rules/rule_set.dart'; | ||
import 'package:gearforce/screens/roster/combatGroup/combat_group_options_dialog.dart'; | ||
|
||
const _splashRadius = 20.0; | ||
|
||
class CombatGroupOptionsButton extends StatelessWidget { | ||
final CombatGroup cg; | ||
final RuleSet ruleSet; | ||
|
||
const CombatGroupOptionsButton({ | ||
super.key, | ||
required this.cg, | ||
required this.ruleSet, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final settingsIcon = ruleSet.combatGroupSettings().length > 0 | ||
? Icons.settings_suggest | ||
: Icons.settings; | ||
|
||
final widget = IconButton( | ||
constraints: BoxConstraints.tightForFinite(), | ||
onPressed: () => {_showOptionsDialog(context)}, | ||
icon: Icon( | ||
settingsIcon, | ||
color: Colors.green, | ||
), | ||
splashRadius: _splashRadius, | ||
padding: EdgeInsets.zero, | ||
tooltip: 'Options for ${cg.name}', | ||
); | ||
|
||
return widget; | ||
} | ||
|
||
void _showOptionsDialog(BuildContext context) { | ||
final settingsDialog = CombatGroupOptionsDialog( | ||
cg: cg, | ||
ruleSet: ruleSet, | ||
); | ||
showDialog( | ||
context: context, | ||
builder: (BuildContext context) { | ||
return settingsDialog; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gearforce/models/combatGroups/group.dart'; | ||
import 'package:gearforce/models/mods/duelist/duelist_modification.dart'; | ||
import 'package:gearforce/models/rules/rule_set.dart'; | ||
import 'package:gearforce/widgets/display_value.dart'; | ||
import 'package:gearforce/widgets/settings.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class GroupActionsDisplay extends StatelessWidget { | ||
final Group group; | ||
final EdgeInsets padding; | ||
final RuleSet ruleSet; | ||
|
||
const GroupActionsDisplay({ | ||
super.key, | ||
required this.group, | ||
required this.padding, | ||
required this.ruleSet, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final settings = context.read<Settings>(); | ||
|
||
final isPrimary = group.groupType == GroupType.Primary; | ||
|
||
final actions = group.totalActions(); | ||
final maxPrimaryActions = ruleSet.maxPrimaryActions; | ||
final minPrimaryActions = ruleSet.minPrimaryActions; | ||
final maxSecondaryAction = | ||
ruleSet.maxSecondaryActions(group.combatGroup!.primary.totalActions()); | ||
|
||
final widget = Tooltip( | ||
waitDuration: settings.tooltipDelay, | ||
message: isPrimary | ||
// a cg is only valid if the number of actions is greater then 4 and | ||
// less then or equal to 6 | ||
? actions > maxPrimaryActions || actions < minPrimaryActions | ||
? 'must have between $minPrimaryActions and $maxPrimaryActions actions' | ||
: 'valid number of actions' | ||
: actions > maxSecondaryAction | ||
? 'cannot have more then $maxSecondaryAction actions' | ||
: 'valid number of actions', | ||
child: DisplayValue( | ||
text: 'Actions', | ||
value: actions, | ||
textColor: group.combatGroup?.modCount(independentOperatorId) != 0 | ||
? Colors.green | ||
: isPrimary | ||
// a cg is only valid if the number of actions is greater then 4 and | ||
// less then or equal to 6 | ||
? actions > maxPrimaryActions || actions < minPrimaryActions | ||
? Colors.red | ||
: Colors.green | ||
: actions > maxSecondaryAction | ||
? Colors.red | ||
: Colors.green, | ||
padding: padding, | ||
), | ||
); | ||
|
||
return widget; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.