Damage calculator items are now draggable

This commit is contained in:
dan63047 2024-09-25 01:57:37 +03:00
parent 868da0c304
commit 0b01fe80b4
1 changed files with 43 additions and 30 deletions

View File

@ -298,6 +298,8 @@ class ClearData{
damage = max(log(COMBO_MINIFIER * (combo - 1) * COMBO_MINIFIER_LOG), damage); damage = max(log(COMBO_MINIFIER * (combo - 1) * COMBO_MINIFIER_LOG), damage);
} }
if (perfectClear) damage += 10;
return damage.floor(); return damage.floor();
} }
} }
@ -473,39 +475,24 @@ class _DestinationCalculatorState extends State<DestinationCalculator> {
int dmg = lineclear.dealsDamage(combo, b2b, ComboTables.modern); int dmg = lineclear.dealsDamage(combo, b2b, ComboTables.modern);
lSideWidgets.add( lSideWidgets.add(
ListTile( ListTile(
key: ValueKey(lineclear.id),
leading: Row( leading: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
IconButton(onPressed: (){ setState((){clears.removeWhere((element) => element.id == lineclear.id,);}); }, icon: Icon(Icons.clear)), IconButton(onPressed: (){ setState((){clears.removeWhere((element) => element.id == lineclear.id,);}); }, icon: Icon(Icons.clear)),
IconButton(onPressed: (){ setState((){clears.removeWhere((element) => element.id == lineclear.id,);}); }, icon: Icon(Icons.pregnant_woman)), IconButton(onPressed: (){ setState((){lineclear.togglePC();}); }, icon: Icon(Icons.pregnant_woman)),
], ],
), ),
title: Text("${lineclear.title}${combo > 0 ? ", ${combo} combo" : ""}${b2b > 0 ? ", B2Bx${b2b}" : ""}"), title: Text("${lineclear.title}${lineclear.perfectClear ? " PC" : ""}${combo > 0 ? ", ${combo} combo" : ""}${b2b > 0 ? ", B2Bx${b2b}" : ""}"),
subtitle: Text("${dmg} damage${lineclear.difficultClear ? ", difficult" : ""}", style: TextStyle(color: Colors.grey)), subtitle: Text("${dmg} damage${lineclear.difficultClear ? ", difficult" : ""}", style: TextStyle(color: Colors.grey)),
trailing: Text(dmg.toString(), style: TextStyle(fontSize: 36, fontWeight: ui.FontWeight.w100)), trailing: Padding(
padding: const EdgeInsets.only(right: 10.0),
child: Text(dmg.toString(), style: TextStyle(fontSize: 36, fontWeight: ui.FontWeight.w100)),
),
) )
); );
totalDamage += dmg; totalDamage += dmg;
} }
lSideWidgets.add(Divider());
lSideWidgets.add(
Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16.0, 0.0, 24.0, 0.0),
child: Row(
children: [
Text("Total damage:"),
Spacer(),
Text(totalDamage.floor().toString(), style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36, fontWeight: ui.FontWeight.w100))
],
),
),
ElevatedButton.icon(onPressed: (){setState((){clears.clear();});}, icon: const Icon(Icons.clear), label: Text("Clear all"), style: const ButtonStyle(shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(12.0))))))
],
)
);
return Column( return Column(
children: [ children: [
@ -563,15 +550,41 @@ class _DestinationCalculatorState extends State<DestinationCalculator> {
width: widget.constraints.maxWidth - 350 - 80, width: widget.constraints.maxWidth - 350 - 80,
height: widget.constraints.maxHeight - 148, height: widget.constraints.maxHeight - 148,
child: clears.isEmpty ? Center(child: Text("Click on the actions on the left to add them here", textAlign: ui.TextAlign.center)) : child: clears.isEmpty ? Center(child: Text("Click on the actions on the left to add them here", textAlign: ui.TextAlign.center)) :
SingleChildScrollView( Card(
child: Card( child: Column(
child: Column( children: [
children: [ Expanded(
Column( child: ReorderableListView(
onReorder: (oldIndex, newIndex) {
setState((){
if (oldIndex < newIndex) {
newIndex -= 1;
}
final ClearData item = clears.removeAt(oldIndex);
clears.insert(newIndex, item);
});
},
children: lSideWidgets, children: lSideWidgets,
) ),
], ),
), Divider(),
Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16.0, 0.0, 34.0, 0.0),
child: Row(
children: [
Text("Total damage:"),
Spacer(),
Text(totalDamage.floor().toString(), style: TextStyle(fontFamily: "Eurostile Round Extended", fontSize: 36, fontWeight: ui.FontWeight.w100))
],
),
),
ElevatedButton.icon(onPressed: (){setState((){clears.clear();});}, icon: const Icon(Icons.clear), label: Text("Clear all"), style: const ButtonStyle(shape: WidgetStatePropertyAll(RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(12.0))))))
],
)
],
), ),
), ),
) )