Skip to content

Commit

Permalink
fixed roll builder state
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Asraf committed Jun 23, 2020
1 parent 888fbd1 commit 033bd3d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/src/atoms/modifier_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ModifierSelector extends StatelessWidget {
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.4),
fontSize: normalText.fontSize * 0.75);
return Container(
width: 100,
width: 70,
child: DropdownButton(
isExpanded: true,
value: value,
Expand Down
10 changes: 4 additions & 6 deletions lib/src/dialogs/roll_dice_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ class RollDiceDialog extends StatefulWidget {
}

class _RollDiceDialogState extends State<RollDiceDialog> {
DiceListController addingController;
List<List<Dice>> diceList = [];
List<DiceListController> controllers = [];

static List<Dice> DEFAULT_DICE = [Dice.d6 * 2];
List<List<Dice>> diceList;
List<DiceListController> controllers;

@override
void initState() {
addingController = DiceListController(DEFAULT_DICE);
diceList = [];
controllers = [];
super.initState();
}

Expand Down
3 changes: 3 additions & 0 deletions lib/src/molecules/dice_roll_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class _DiceRollBoxState extends State<DiceRollBox>
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Card(
color: Theme.of(context).canvasColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
children: [
Container(
Expand Down
7 changes: 6 additions & 1 deletion lib/src/molecules/dice_roll_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class _DiceRollBuilderState extends State<DiceRollBuilder> {

@override
void initState() {
addingController = DiceListController(DEFAULT_DICE);
addingController = DiceListController(List.from(DEFAULT_DICE));
super.initState();
}

Expand All @@ -38,6 +38,9 @@ class _DiceRollBuilderState extends State<DiceRollBuilder> {
return Card(
color: Theme.of(context).canvasColor,
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expand Down Expand Up @@ -68,12 +71,14 @@ class _DiceRollBuilderState extends State<DiceRollBuilder> {
}
},
),
SizedBox(width: 16),
ModifierSelector(
value: d.value.modifier,
character: widget.character,
onChanged: (n) => _setMod(d.index, n),
textStyle: TextStyle(fontSize: 20),
),
Expanded(child: Container()),
if (addingController.value.length > 1)
IconButton(
icon: Icon(Icons.close),
Expand Down

0 comments on commit 033bd3d

Please sign in to comment.