mirror of
https://github.com/DungeonPaper/dungeon-paper-app.git
synced 2026-05-17 17:58:11 +00:00
dartfmt + lint fixes + intl
This commit is contained in:
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"autovalidate",
|
||||
"cupertino",
|
||||
"dungeonpaper",
|
||||
"favorited",
|
||||
@@ -7,6 +8,9 @@
|
||||
"localstorage",
|
||||
"Localstore",
|
||||
"Nunito",
|
||||
"vsync"
|
||||
"prefs",
|
||||
"Schyler",
|
||||
"vsync",
|
||||
"wakelock"
|
||||
]
|
||||
}
|
||||
@@ -23,7 +23,7 @@ linter:
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
|
||||
@@ -19,8 +19,8 @@ class AlignmentValue extends dw.AlignmentValue {
|
||||
|
||||
factory AlignmentValue.fromJson(Map<String, dynamic> json) => AlignmentValue(
|
||||
meta: Meta.fromJson(json['_meta']),
|
||||
key: json["key"],
|
||||
description: json["description"],
|
||||
key: json['key'],
|
||||
description: json['description'],
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -51,12 +51,12 @@ class AlignmentValues extends dw.AlignmentValues {
|
||||
factory AlignmentValues.fromRawJson(String str) => AlignmentValues.fromJson(json.decode(str));
|
||||
|
||||
factory AlignmentValues.fromJson(Map<String, dynamic> json) => AlignmentValues(
|
||||
meta: Meta.fromJson(json["_meta"]),
|
||||
good: json["good"],
|
||||
evil: json["evil"],
|
||||
lawful: json["lawful"],
|
||||
neutral: json["neutral"],
|
||||
chaotic: json["chaotic"],
|
||||
meta: Meta.fromJson(json['_meta']),
|
||||
good: json['good'],
|
||||
evil: json['evil'],
|
||||
lawful: json['lawful'],
|
||||
neutral: json['neutral'],
|
||||
chaotic: json['chaotic'],
|
||||
);
|
||||
|
||||
factory AlignmentValues.fromDwAlignmentValues(dw.AlignmentValues original) => AlignmentValues(
|
||||
|
||||
@@ -29,14 +29,14 @@ class Bio {
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory Bio.fromJson(Map<String, dynamic> json) => Bio(
|
||||
looks: List<String>.from(json["looks"].map((x) => x)),
|
||||
description: json["description"],
|
||||
alignment: AlignmentValue.fromJson(json["alignment"]),
|
||||
looks: List<String>.from(json['looks'].map((x) => x)),
|
||||
description: json['description'],
|
||||
alignment: AlignmentValue.fromJson(json['alignment']),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"looks": List<dynamic>.from(looks.map((x) => x)),
|
||||
"description": description,
|
||||
"alignment": alignment.toJson(),
|
||||
'looks': List<dynamic>.from(looks.map((x) => x)),
|
||||
'description': description,
|
||||
'alignment': alignment.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ class Bond extends dw.Bond {
|
||||
factory Bond.fromRawJson(String str) => Bond.fromJson(json.decode(str));
|
||||
|
||||
factory Bond.fromJson(Map<String, dynamic> json) => Bond(
|
||||
key: json["key"],
|
||||
completed: json["completed"],
|
||||
description: json["description"],
|
||||
key: json['key'],
|
||||
completed: json['completed'],
|
||||
description: json['description'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,11 +95,11 @@ class Character {
|
||||
return Character(
|
||||
key: uuid(),
|
||||
meta: Meta.version(1),
|
||||
displayName: "",
|
||||
avatarUrl: "",
|
||||
displayName: '',
|
||||
avatarUrl: '',
|
||||
items: [],
|
||||
bio: Bio(
|
||||
description: "",
|
||||
description: '',
|
||||
looks: [],
|
||||
alignment:
|
||||
AlignmentValue(meta: Meta.version(1), key: 'good', description: 'Do something good'),
|
||||
@@ -128,10 +128,10 @@ class Character {
|
||||
spells: [],
|
||||
race: Race(
|
||||
key: uuid(),
|
||||
name: "Human",
|
||||
name: 'Human',
|
||||
classKeys: [characterClass.key],
|
||||
description: "",
|
||||
explanation: "",
|
||||
description: '',
|
||||
explanation: '',
|
||||
meta: Meta.version(1),
|
||||
tags: [],
|
||||
),
|
||||
@@ -143,10 +143,10 @@ class Character {
|
||||
characterClass: characterClass,
|
||||
race: Race(
|
||||
key: uuid(),
|
||||
name: "Human",
|
||||
name: 'Human',
|
||||
classKeys: [characterClass.key],
|
||||
description: "",
|
||||
explanation: "",
|
||||
description: '',
|
||||
explanation: '',
|
||||
meta: Meta.version(1),
|
||||
tags: [],
|
||||
),
|
||||
@@ -156,37 +156,37 @@ class Character {
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory Character.fromJson(Map<String, dynamic> json) => Character(
|
||||
meta: Meta.fromJson(json["_meta"]),
|
||||
key: json["key"],
|
||||
displayName: json["displayName"],
|
||||
avatarUrl: json["avatarURL"],
|
||||
characterClass: CharacterClass.fromJson(json["class"]),
|
||||
moves: List<Move>.from(json["moves"].map((x) => Move.fromJson(x))),
|
||||
spells: List<Spell>.from(json["spells"].map((x) => Spell.fromJson(x))),
|
||||
items: List<Item>.from(json["items"].map((x) => Item.fromJson(x))),
|
||||
notes: List<Note>.from(json["notes"].map((x) => Note.fromJson(x))),
|
||||
stats: CharacterStats.fromJson(json["stats"]),
|
||||
rollStats: RollStats.fromJson(json["rollStats"]),
|
||||
bonds: List<Bond>.from(json["bonds"].map((x) => Bond.fromJson(x))),
|
||||
bio: Bio.fromJson(json["bio"]),
|
||||
race: Race.fromJson(json["race"]),
|
||||
meta: Meta.fromJson(json['_meta']),
|
||||
key: json['key'],
|
||||
displayName: json['displayName'],
|
||||
avatarUrl: json['avatarURL'],
|
||||
characterClass: CharacterClass.fromJson(json['class']),
|
||||
moves: List<Move>.from(json['moves'].map((x) => Move.fromJson(x))),
|
||||
spells: List<Spell>.from(json['spells'].map((x) => Spell.fromJson(x))),
|
||||
items: List<Item>.from(json['items'].map((x) => Item.fromJson(x))),
|
||||
notes: List<Note>.from(json['notes'].map((x) => Note.fromJson(x))),
|
||||
stats: CharacterStats.fromJson(json['stats']),
|
||||
rollStats: RollStats.fromJson(json['rollStats']),
|
||||
bonds: List<Bond>.from(json['bonds'].map((x) => Bond.fromJson(x))),
|
||||
bio: Bio.fromJson(json['bio']),
|
||||
race: Race.fromJson(json['race']),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"_meta": meta.toJson(),
|
||||
"key": key,
|
||||
"displayName": displayName,
|
||||
"avatarURL": avatarUrl,
|
||||
"class": characterClass.toJson(),
|
||||
"moves": List<dynamic>.from(moves.map((x) => x.toJson())),
|
||||
"spells": List<dynamic>.from(spells.map((x) => x.toJson())),
|
||||
"items": List<dynamic>.from(items.map((x) => x.toJson())),
|
||||
"notes": List<dynamic>.from(notes.map((x) => x.toJson())),
|
||||
"stats": stats.toJson(),
|
||||
"rollStats": rollStats.toJson(),
|
||||
"bonds": List<dynamic>.from(bonds.map((x) => x.toJson())),
|
||||
"bio": bio.toJson(),
|
||||
"race": race.toJson(),
|
||||
'_meta': meta.toJson(),
|
||||
'key': key,
|
||||
'displayName': displayName,
|
||||
'avatarURL': avatarUrl,
|
||||
'class': characterClass.toJson(),
|
||||
'moves': List<dynamic>.from(moves.map((x) => x.toJson())),
|
||||
'spells': List<dynamic>.from(spells.map((x) => x.toJson())),
|
||||
'items': List<dynamic>.from(items.map((x) => x.toJson())),
|
||||
'notes': List<dynamic>.from(notes.map((x) => x.toJson())),
|
||||
'stats': stats.toJson(),
|
||||
'rollStats': rollStats.toJson(),
|
||||
'bonds': List<dynamic>.from(bonds.map((x) => x.toJson())),
|
||||
'bio': bio.toJson(),
|
||||
'race': race.toJson(),
|
||||
};
|
||||
|
||||
int get currentHp => clamp(stats.currentHp, 0, maxHp);
|
||||
|
||||
@@ -76,20 +76,20 @@ class CharacterClass extends dw.CharacterClass {
|
||||
factory CharacterClass.empty() => CharacterClass(
|
||||
meta: Meta.version(1),
|
||||
key: uuid(),
|
||||
name: "",
|
||||
name: '',
|
||||
bonds: [],
|
||||
damageDice: dw.Dice.d6,
|
||||
description: "",
|
||||
description: '',
|
||||
gearChoices: [],
|
||||
load: 0,
|
||||
hp: 20,
|
||||
alignments: AlignmentValues(
|
||||
meta: Meta.version(1),
|
||||
neutral: "",
|
||||
chaotic: "",
|
||||
evil: "",
|
||||
good: "",
|
||||
lawful: "",
|
||||
neutral: '',
|
||||
chaotic: '',
|
||||
evil: '',
|
||||
good: '',
|
||||
lawful: '',
|
||||
),
|
||||
);
|
||||
|
||||
@@ -112,6 +112,6 @@ class CharacterClass extends dw.CharacterClass {
|
||||
@override
|
||||
Map<String, dynamic> toJson() => {
|
||||
...super.toJson(),
|
||||
"_meta": meta.toJson(),
|
||||
'_meta': meta.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -46,22 +46,22 @@ class CharacterStats {
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory CharacterStats.fromJson(Map<String, dynamic> json) => CharacterStats(
|
||||
level: json["level"],
|
||||
maxHp: json["maxHP"],
|
||||
currentHp: json["currentHP"],
|
||||
currentExp: json["currentEXP"],
|
||||
armor: json["armor"],
|
||||
damageDice: json["damageDice"],
|
||||
load: json["load"],
|
||||
level: json['level'],
|
||||
maxHp: json['maxHP'],
|
||||
currentHp: json['currentHP'],
|
||||
currentExp: json['currentEXP'],
|
||||
armor: json['armor'],
|
||||
damageDice: json['damageDice'],
|
||||
load: json['load'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"level": level,
|
||||
"maxHP": maxHp,
|
||||
"currentHP": currentHp,
|
||||
"currentEXP": currentExp,
|
||||
"armor": armor,
|
||||
"damageDice": damageDice?.toJson(),
|
||||
"load": load,
|
||||
'level': level,
|
||||
'maxHP': maxHp,
|
||||
'currentHP': currentHp,
|
||||
'currentEXP': currentExp,
|
||||
'armor': armor,
|
||||
'damageDice': damageDice?.toJson(),
|
||||
'load': load,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,15 +29,12 @@ class GearChoice extends dw.GearChoice {
|
||||
selections: selections ?? this.selections,
|
||||
);
|
||||
|
||||
factory GearChoice.fromRawJson(String str) =>
|
||||
GearChoice.fromJson(json.decode(str));
|
||||
factory GearChoice.fromRawJson(String str) => GearChoice.fromJson(json.decode(str));
|
||||
|
||||
factory GearChoice.fromDwGearChoice(dw.GearChoice gearChoice) => GearChoice(
|
||||
key: gearChoice.key,
|
||||
description: gearChoice.description,
|
||||
selections: gearChoice.selections
|
||||
.map((s) => GearSelection.fromDwGearSelection(s))
|
||||
.toList(),
|
||||
selections: gearChoice.selections.map((s) => GearSelection.fromDwGearSelection(s)).toList(),
|
||||
);
|
||||
|
||||
factory GearChoice.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -46,6 +43,6 @@ class GearChoice extends dw.GearChoice {
|
||||
@override
|
||||
Map<String, dynamic> toJson() => {
|
||||
...super.toJson(),
|
||||
"selections": List<dynamic>.from(selections.map((x) => x.toJson())),
|
||||
'selections': List<dynamic>.from(selections.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ import 'dart:convert';
|
||||
import 'package:dungeon_world_data/dungeon_world_data.dart' as dw;
|
||||
import 'package:dungeon_world_data/gear_option.dart';
|
||||
|
||||
import 'item.dart';
|
||||
|
||||
class GearSelection extends dw.GearSelection {
|
||||
GearSelection({
|
||||
required String description,
|
||||
@@ -37,8 +35,8 @@ class GearSelection extends dw.GearSelection {
|
||||
GearSelection.fromJson(gearSelection.toJson());
|
||||
|
||||
factory GearSelection.fromJson(Map<String, dynamic> json) => GearSelection(
|
||||
description: json["description"],
|
||||
items: List<GearOption>.from(json["items"].map((x) => GearSelection.fromJson(x))),
|
||||
gold: json["gold"],
|
||||
description: json['description'],
|
||||
items: List<GearOption>.from(json['items'].map((x) => GearSelection.fromJson(x))),
|
||||
gold: json['gold'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class Item extends dw.Item {
|
||||
@override
|
||||
Map<String, dynamic> toJson() => {
|
||||
...super.toJson(),
|
||||
"_meta": meta.toJson(),
|
||||
"amount": amount,
|
||||
'_meta': meta.toJson(),
|
||||
'amount': amount,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,22 +26,21 @@ class ItemSettings {
|
||||
equipped: equipped ?? this.equipped,
|
||||
);
|
||||
|
||||
factory ItemSettings.fromRawJson(String str) =>
|
||||
ItemSettings.fromJson(json.decode(str));
|
||||
factory ItemSettings.fromRawJson(String str) => ItemSettings.fromJson(json.decode(str));
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory ItemSettings.fromJson(Map<String, dynamic> json) => ItemSettings(
|
||||
countArmor: json["countArmor"],
|
||||
countDamage: json["countDamage"],
|
||||
countWeight: json["countWeight"],
|
||||
equipped: json["equipped"],
|
||||
countArmor: json['countArmor'],
|
||||
countDamage: json['countDamage'],
|
||||
countWeight: json['countWeight'],
|
||||
equipped: json['equipped'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"countArmor": countArmor,
|
||||
"countDamage": countDamage,
|
||||
"countWeight": countWeight,
|
||||
"equipped": equipped,
|
||||
'countArmor': countArmor,
|
||||
'countDamage': countDamage,
|
||||
'countWeight': countWeight,
|
||||
'equipped': equipped,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,17 +44,17 @@ class Meta {
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
|
||||
created: json["created"] != null ? DateTime.parse(json["created"]) : DateTime.now(),
|
||||
updated: json["updated"] != null ? DateTime.parse(json["updated"]) : null,
|
||||
schemaVersion: json["schemaVersion"] ?? 1,
|
||||
sharing: json['sharing'] != null ? MetaSharing.fromJson(json["sharing"]) : null,
|
||||
created: json['created'] != null ? DateTime.parse(json['created']) : DateTime.now(),
|
||||
updated: json['updated'] != null ? DateTime.parse(json['updated']) : null,
|
||||
schemaVersion: json['schemaVersion'] ?? 1,
|
||||
sharing: json['sharing'] != null ? MetaSharing.fromJson(json['sharing']) : null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"created": created.toString(),
|
||||
"updated": updated?.toString(),
|
||||
"schemaVersion": schemaVersion,
|
||||
"sharing": sharing?.toJson(),
|
||||
'created': created.toString(),
|
||||
'updated': updated?.toString(),
|
||||
'schemaVersion': schemaVersion,
|
||||
'sharing': sharing?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -90,17 +90,17 @@ class MetaSharing {
|
||||
|
||||
factory MetaSharing.fromJson(Map<String, dynamic> json) {
|
||||
return MetaSharing(
|
||||
shared: json["shared"] ?? false,
|
||||
outOfSync: json["outOfSync"] ?? false,
|
||||
originalKey: json["originalKey"],
|
||||
createdBy: json["createdBy"],
|
||||
shared: json['shared'] ?? false,
|
||||
outOfSync: json['outOfSync'] ?? false,
|
||||
originalKey: json['originalKey'],
|
||||
createdBy: json['createdBy'],
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"shared": shared,
|
||||
"outOfSync": outOfSync,
|
||||
"originalKey": originalKey,
|
||||
"createdBy": createdBy,
|
||||
'shared': shared,
|
||||
'outOfSync': outOfSync,
|
||||
'originalKey': originalKey,
|
||||
'createdBy': createdBy,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ class Move extends dw.Move {
|
||||
@override
|
||||
Map<String, dynamic> toJson() => {
|
||||
...super.toJson(),
|
||||
"_meta": meta.toJson(),
|
||||
"favorited": favorited,
|
||||
'_meta': meta.toJson(),
|
||||
'favorited': favorited,
|
||||
};
|
||||
|
||||
Widget get icon => SvgIcon(DwIcons.riposte);
|
||||
|
||||
@@ -38,18 +38,18 @@ class Note {
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory Note.fromJson(Map<String, dynamic> json) => Note(
|
||||
meta: Meta.fromJson(json["_meta"]),
|
||||
key: json["key"],
|
||||
title: json["title"],
|
||||
description: json["description"],
|
||||
tags: List<dw.Tag>.from(json["tags"].map((x) => dw.Tag.fromJson(x))),
|
||||
meta: Meta.fromJson(json['_meta']),
|
||||
key: json['key'],
|
||||
title: json['title'],
|
||||
description: json['description'],
|
||||
tags: List<dw.Tag>.from(json['tags'].map((x) => dw.Tag.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"_meta": meta.toJson(),
|
||||
"key": key,
|
||||
"title": title,
|
||||
"description": description,
|
||||
"tags": List<dynamic>.from(tags.map((x) => x.toJson())),
|
||||
'_meta': meta.toJson(),
|
||||
'key': key,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'tags': List<dynamic>.from(tags.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -59,18 +59,18 @@ class Race extends dw.Race {
|
||||
);
|
||||
|
||||
factory Race.fromJson(Map<String, dynamic> json) => Race(
|
||||
meta: Meta.fromJson(json["_meta"]),
|
||||
key: json["key"],
|
||||
name: json["name"],
|
||||
description: json["description"],
|
||||
explanation: json["explanation"],
|
||||
classKeys: List<String>.from(json["classKeys"].map((x) => x)),
|
||||
tags: List<dw.Tag>.from(json["tags"].map((x) => dw.Tag.fromJson(x))),
|
||||
meta: Meta.fromJson(json['_meta']),
|
||||
key: json['key'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
explanation: json['explanation'],
|
||||
classKeys: List<String>.from(json['classKeys'].map((x) => x)),
|
||||
tags: List<dw.Tag>.from(json['tags'].map((x) => dw.Tag.fromJson(x))),
|
||||
);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => {
|
||||
...super.toJson(),
|
||||
"_meta": meta.toJson(),
|
||||
'_meta': meta.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../core/dw_icons.dart';
|
||||
import '../../widgets/atoms/svg_icon.dart';
|
||||
@@ -20,12 +19,12 @@ class RollStats {
|
||||
required int cha,
|
||||
}) =>
|
||||
RollStats(stats: [
|
||||
RollStat(key: "STR", name: "Strength", value: str),
|
||||
RollStat(key: "DEX", name: "Dexterity", value: dex),
|
||||
RollStat(key: "CON", name: "Constitution", value: con),
|
||||
RollStat(key: "INT", name: "Intelligence", value: intl),
|
||||
RollStat(key: "WIS", name: "Wisdom", value: wis),
|
||||
RollStat(key: "CHA", name: "Charisma", value: cha),
|
||||
RollStat(key: 'STR', name: 'Strength', value: str),
|
||||
RollStat(key: 'DEX', name: 'Dexterity', value: dex),
|
||||
RollStat(key: 'CON', name: 'Constitution', value: con),
|
||||
RollStat(key: 'INT', name: 'Intelligence', value: intl),
|
||||
RollStat(key: 'WIS', name: 'Wisdom', value: wis),
|
||||
RollStat(key: 'CHA', name: 'Charisma', value: cha),
|
||||
]);
|
||||
|
||||
final List<RollStat> stats;
|
||||
@@ -44,17 +43,17 @@ class RollStats {
|
||||
RollStat getStat(String statKey) {
|
||||
statKey = statKey.trim().toUpperCase();
|
||||
if (!statsMap.containsKey(statKey)) {
|
||||
throw Exception("Stat $statKey not found, available: ${statsMap.keys}");
|
||||
throw Exception('Stat $statKey not found, available: ${statsMap.keys}');
|
||||
}
|
||||
return statsMap[statKey]!;
|
||||
}
|
||||
|
||||
RollStat get dex => getStat("dex");
|
||||
RollStat get str => getStat("str");
|
||||
RollStat get wis => getStat("wis");
|
||||
RollStat get con => getStat("con");
|
||||
RollStat get intl => getStat("int");
|
||||
RollStat get cha => getStat("cha");
|
||||
RollStat get dex => getStat('dex');
|
||||
RollStat get str => getStat('str');
|
||||
RollStat get wis => getStat('wis');
|
||||
RollStat get con => getStat('con');
|
||||
RollStat get intl => getStat('int');
|
||||
RollStat get cha => getStat('cha');
|
||||
|
||||
int get dexMod => dex.modifier;
|
||||
int get strMod => str.modifier;
|
||||
@@ -68,7 +67,7 @@ class RollStats {
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"stats": stats.map((s) => s.toJson()).toList(),
|
||||
'stats': stats.map((s) => s.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,13 +86,13 @@ class RollStat {
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"key": key,
|
||||
"name": name,
|
||||
"value": value,
|
||||
'key': key,
|
||||
'name': name,
|
||||
'value': value,
|
||||
};
|
||||
|
||||
int get modifier => modifierForValue(value);
|
||||
Widget get icon => _icons[key.toLowerCase()] ?? _icons["_other"]!;
|
||||
Widget get icon => _icons[key.toLowerCase()] ?? _icons['_other']!;
|
||||
|
||||
static int modifierForValue(int value) {
|
||||
var modifiers = {1: -3, 4: -2, 6: -1, 9: 0, 13: 1, 16: 2, 18: 3};
|
||||
@@ -112,12 +111,12 @@ class RollStat {
|
||||
}
|
||||
|
||||
static final _icons = <String, Widget>{
|
||||
"dex": SvgIcon(DwIcons.stat_dex),
|
||||
"str": SvgIcon(DwIcons.stat_str),
|
||||
"wis": SvgIcon(DwIcons.stat_wis),
|
||||
"con": SvgIcon(DwIcons.stat_con),
|
||||
"int": SvgIcon(DwIcons.stat_int),
|
||||
"cha": SvgIcon(DwIcons.stat_cha),
|
||||
"_other": Icon(Icons.help),
|
||||
'dex': SvgIcon(DwIcons.stat_dex),
|
||||
'str': SvgIcon(DwIcons.stat_str),
|
||||
'wis': SvgIcon(DwIcons.stat_wis),
|
||||
'con': SvgIcon(DwIcons.stat_con),
|
||||
'int': SvgIcon(DwIcons.stat_int),
|
||||
'cha': SvgIcon(DwIcons.stat_cha),
|
||||
'_other': const Icon(Icons.help),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ class Spell extends dw.Spell {
|
||||
@override
|
||||
Map<String, dynamic> toJson() => {
|
||||
...super.toJson(),
|
||||
"_meta": meta.toJson(),
|
||||
"prepared": prepared,
|
||||
'_meta': meta.toJson(),
|
||||
'prepared': prepared,
|
||||
};
|
||||
|
||||
Widget get icon => SvgIcon(DwIcons.book_cover);
|
||||
|
||||
@@ -9,7 +9,7 @@ class CharacterListPageController extends GetxController {
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
characters.addAll((await StorageHandler.instance.getAllItems("characters"))
|
||||
characters.addAll((await StorageHandler.instance.getAllItems('characters'))
|
||||
.map((c) => Character.fromJson(c)));
|
||||
characters.refresh();
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class CharacterListPageController extends GetxController {
|
||||
|
||||
void addCharacter(Character char) {
|
||||
characters.add(char);
|
||||
StorageHandler.instance.create("characters", char.key, char.toJson());
|
||||
StorageHandler.instance.create('characters', char.key, char.toJson());
|
||||
characters.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class CharacterListPageView extends GetView<CharacterListPageController> {
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => controller.addCharacter(Character.empty()),
|
||||
// ignore: prefer_single_quotes
|
||||
child: Text(S.current.createCharacterAddButton + " (Empty)"),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -42,15 +42,13 @@ class CharacterInformationView extends GetView<CreateCharacterPageController> {
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Obx(
|
||||
() => Text(
|
||||
"Valid: ${controller.isValid[CreateCharStep.information]}"),
|
||||
() => Text('Valid: ${controller.isValid[CreateCharStep.information]}'),
|
||||
),
|
||||
TextFormField(
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
controller: displayName,
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (val) =>
|
||||
val == null || val.isEmpty ? "Cannot be empty" : null,
|
||||
validator: (val) => val == null || val.isEmpty ? 'Cannot be empty' : null,
|
||||
decoration: InputDecoration(
|
||||
labelText: S.current.createCharacterNameFieldLabel,
|
||||
hintText: S.current.createCharacterNameFieldPlaceholder,
|
||||
|
||||
@@ -25,7 +25,7 @@ class CreateCharacterPageView extends GetView<CreateCharacterPageController> {
|
||||
controller: controller.currentStep,
|
||||
children: [
|
||||
CharacterInformationView(),
|
||||
SelectCharacterClassView(),
|
||||
const SelectCharacterClassView(),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
|
||||
@@ -4,11 +4,14 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../generated/l10n.dart';
|
||||
import '../../../widgets/atoms/character_avatar.dart';
|
||||
import '../../../widgets/atoms/labeled_icon_button.dart';
|
||||
import '../../../widgets/atoms/svg_icon.dart';
|
||||
|
||||
class HomeCharacterHeaderView extends GetView<CharacterService> {
|
||||
const HomeCharacterHeaderView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
@@ -19,14 +22,14 @@ class HomeCharacterHeaderView extends GetView<CharacterService> {
|
||||
LabeledIconButton(
|
||||
onPressed: () => null,
|
||||
icon: SvgIcon(DwIcons.knapsack),
|
||||
label: "Items",
|
||||
label: S.current.quickIconsItems,
|
||||
shadowOffset: const Offset(-2, -2),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
LabeledIconButton(
|
||||
onPressed: () => null,
|
||||
icon: SvgIcon(DwIcons.scroll_quill),
|
||||
label: "+ Note",
|
||||
label: S.current.quickIconsNote,
|
||||
shadowOffset: const Offset(-2, 2),
|
||||
),
|
||||
],
|
||||
@@ -39,14 +42,14 @@ class HomeCharacterHeaderView extends GetView<CharacterService> {
|
||||
LabeledIconButton(
|
||||
onPressed: () => null,
|
||||
icon: SvgIcon(DwIcons.hand_rock),
|
||||
label: "Moves",
|
||||
label: S.current.quickIconsMoves,
|
||||
shadowOffset: const Offset(2, -2),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
LabeledIconButton(
|
||||
onPressed: () => null,
|
||||
icon: SvgIcon(DwIcons.book_cover),
|
||||
label: "Spells",
|
||||
label: S.current.quickIconsSpells,
|
||||
shadowOffset: const Offset(2, 2),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -7,21 +7,23 @@ import 'package:get/get.dart';
|
||||
import '../../../widgets/atoms/exp_bar.dart';
|
||||
|
||||
class HomeCharacterHpExpView extends GetView<CharacterService> {
|
||||
const HomeCharacterHpExpView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
child: HpBar(),
|
||||
child: const HpBar(),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
onTap: () => null,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 24),
|
||||
const SizedBox(width: 24),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
child: ExpBar(),
|
||||
child: const ExpBar(),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
onTap: () => null,
|
||||
),
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:dungeon_paper/app/widgets/atoms/svg_icon.dart';
|
||||
import 'package:dungeon_paper/core/dw_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' as m show TextDirection;
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../data/models/roll_stats.dart';
|
||||
|
||||
@@ -15,8 +14,8 @@ class HomeCharacterRollStatChip extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final valStr = stat.value.toString();
|
||||
final statKey = stat.key;
|
||||
final statName = stat.name;
|
||||
final modSign = stat.modifier >= 0 ? "+" : "-";
|
||||
// final statName = stat.name;
|
||||
final modSign = stat.modifier >= 0 ? '+' : '-';
|
||||
final modStr = stat.modifier.abs().toString();
|
||||
final theme = Theme.of(context);
|
||||
final brightness = ThemeData.estimateBrightnessForColor(theme.canvasColor);
|
||||
@@ -54,7 +53,7 @@ class HomeCharacterRollStatChip extends StatelessWidget {
|
||||
text: TextSpan(
|
||||
style: theme.textTheme.bodyText2,
|
||||
children: [
|
||||
TextSpan(text: statKey + ": "),
|
||||
TextSpan(text: statKey + ': '),
|
||||
TextSpan(
|
||||
text: valStr,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
@@ -89,7 +88,7 @@ class HomeCharacterRollStatChip extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
"$modSign$modStr",
|
||||
'$modSign$modStr',
|
||||
textScaleFactor: 0.7,
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onSurface.withOpacity(rollBadgeTextOpacity),
|
||||
|
||||
@@ -13,6 +13,8 @@ import '../../../themes/button_themes.dart';
|
||||
import '../../../../core/services/character_service.dart';
|
||||
|
||||
class HomeCharacterView extends GetView<CharacterService> {
|
||||
const HomeCharacterView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(
|
||||
@@ -23,16 +25,16 @@ class HomeCharacterView extends GetView<CharacterService> {
|
||||
padding: const EdgeInsets.only(bottom: 0),
|
||||
// crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
p(HomeCharacterHeaderView()),
|
||||
p(const HomeCharacterHeaderView()),
|
||||
p(Text(
|
||||
char?.displayName ?? "...",
|
||||
char?.displayName ?? '...',
|
||||
textScaleFactor: 1.4,
|
||||
textAlign: TextAlign.center,
|
||||
)),
|
||||
p(Text(
|
||||
S.current.characterHeaderSubtitle(
|
||||
char?.stats.level ?? 0,
|
||||
char?.characterClass.name ?? "...",
|
||||
char?.characterClass.name ?? '...',
|
||||
// "test",
|
||||
// char?.bio.toRawJson() ?? 'test',
|
||||
S.current.alignment(char?.bio.alignment.key ?? 'good'),
|
||||
@@ -40,7 +42,7 @@ class HomeCharacterView extends GetView<CharacterService> {
|
||||
textAlign: TextAlign.center,
|
||||
)),
|
||||
p(const SizedBox(height: 8)),
|
||||
p(HomeCharacterHpExpView()),
|
||||
p(const HomeCharacterHpExpView()),
|
||||
p(const SizedBox(height: 16)),
|
||||
p(Center(
|
||||
child: SizedBox(
|
||||
|
||||
@@ -8,21 +8,21 @@ import '../../../../core/services/character_service.dart';
|
||||
import 'home_character_view.dart';
|
||||
|
||||
class HomeView extends GetView<CharacterService> {
|
||||
HomeView({Key? key}) : super(key: key);
|
||||
const HomeView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(S.current.appName),
|
||||
actions: [DebugMenu()],
|
||||
actions: const [DebugMenu()],
|
||||
),
|
||||
body: PageView(
|
||||
controller: controller.pageController,
|
||||
children: [
|
||||
const Center(child: Text("Actions")),
|
||||
children: const [
|
||||
Center(child: Text('Actions')),
|
||||
HomeCharacterView(),
|
||||
const Center(child: Text("Journal")),
|
||||
Center(child: Text('Journal')),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: Obx(
|
||||
@@ -65,15 +65,15 @@ class _CharacterHomeNavBarState extends State<CharacterHomeNavBar> {
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person),
|
||||
label: "Actions",
|
||||
label: 'Actions',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person),
|
||||
label: "Character",
|
||||
label: 'Character',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person),
|
||||
label: "Journal",
|
||||
label: 'Journal',
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ class AppPages {
|
||||
static final routes = [
|
||||
GetPage(
|
||||
name: _Paths.home,
|
||||
page: () => HomeView(),
|
||||
page: () => const HomeView(),
|
||||
binding: HomeBinding(),
|
||||
),
|
||||
GetPage(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class ButtonThemes {
|
||||
static final borderRadius = BorderRadius.circular(10);
|
||||
|
||||
@@ -21,7 +21,7 @@ final parchmentTheme = ThemeData(
|
||||
centerTitle: true,
|
||||
),
|
||||
cardTheme: baseCardTheme,
|
||||
fontFamily: "Nunito",
|
||||
fontFamily: 'Nunito',
|
||||
bottomNavigationBarTheme: _light.bottomNavigationBarTheme.copyWith(
|
||||
backgroundColor: scaffoldBackgroundColor,
|
||||
// selectedItemColor: primaryColor,
|
||||
@@ -30,8 +30,8 @@ final parchmentTheme = ThemeData(
|
||||
);
|
||||
final darkTheme = _dark.copyWith(
|
||||
// primaryColor: primaryColor,
|
||||
textTheme: copyTextThemeWith(_dark.textTheme, fontFamily: "Nunito"),
|
||||
primaryTextTheme: copyTextThemeWith(_dark.primaryTextTheme, fontFamily: "Nunito"),
|
||||
textTheme: copyTextThemeWith(_dark.textTheme, fontFamily: 'Nunito'),
|
||||
primaryTextTheme: copyTextThemeWith(_dark.primaryTextTheme, fontFamily: 'Nunito'),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: _dark.scaffoldBackgroundColor,
|
||||
elevation: 0,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
extension<T> on List<T> {
|
||||
// ignore: unused_element
|
||||
T sample() {
|
||||
final rnd = Random().nextInt(length);
|
||||
return elementAt(rnd);
|
||||
|
||||
@@ -40,8 +40,6 @@ class BackgroundIconButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (elevation != null) {
|
||||
final buttonTheme = ElevatedButtonTheme.of(context);
|
||||
final theme = Theme.of(context);
|
||||
return PhysicalModel(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: bgColor(context),
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CharacterAvatar extends GetView {
|
||||
const CharacterAvatar({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
@@ -14,7 +16,7 @@ class CharacterAvatar extends GetView {
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: controller.current?.avatarUrl.isNotEmpty == true
|
||||
? controller.current!.avatarUrl
|
||||
: "https://via.placeholder.com/704.png?text=Avatar",
|
||||
: 'https://via.placeholder.com/704.png?text=Avatar',
|
||||
width: 176,
|
||||
height: 176,
|
||||
),
|
||||
|
||||
@@ -16,8 +16,8 @@ class DebugMenu extends StatelessWidget {
|
||||
child: Icon(Icons.bug_report),
|
||||
),
|
||||
itemBuilder: (context) => [
|
||||
const PopupMenuItem(child: Text("Toggle dark mode"), value: "toggleDarkMode"),
|
||||
const PopupMenuItem(child: Text("Randomize Char Data"), value: "updateChar"),
|
||||
const PopupMenuItem(child: Text('Toggle dark mode'), value: 'toggleDarkMode'),
|
||||
const PopupMenuItem(child: Text('Randomize Char Data'), value: 'updateChar'),
|
||||
],
|
||||
onSelected: (value) {
|
||||
switch (value) {
|
||||
@@ -28,7 +28,7 @@ class DebugMenu extends StatelessWidget {
|
||||
updateChar();
|
||||
return;
|
||||
default:
|
||||
throw Exception("Unsupported");
|
||||
throw Exception('Unsupported');
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ class ExpBar extends StatelessWidget {
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
char?.currentExp.toString() ?? '-',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text('/' + (char?.maxExp.toString() ?? '-')),
|
||||
],
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:dungeon_paper/app/widgets/atoms/background_icon_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LabeledIconButton extends StatelessWidget {
|
||||
const LabeledIconButton({
|
||||
|
||||
@@ -17,7 +17,7 @@ class SvgIcon extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
// final theme = Theme.of(context);
|
||||
final iconTheme = IconTheme.of(context);
|
||||
|
||||
return SvgPicture.asset(
|
||||
|
||||
@@ -22,7 +22,7 @@ class _ValueNotifierBuilderState extends State<ValueNotifierBuilder> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.value.addListener(() {
|
||||
print("value: " + widget.value.toString());
|
||||
debugPrint('value: ' + widget.value.toString());
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class SpellCardMini extends StatelessWidget {
|
||||
return DynamicActionCardMini(
|
||||
title: spell.name,
|
||||
description: spell.description,
|
||||
chips: [],
|
||||
chips: const [],
|
||||
dice: spell.dice,
|
||||
icon: spell.icon,
|
||||
starred: spell.prepared,
|
||||
|
||||
@@ -59,7 +59,7 @@ class CharacterService extends GetxService {
|
||||
all[character.key] = character;
|
||||
StorageHandler.instance.create('characters', character.key, character.toJson());
|
||||
_current.value ??= character.key;
|
||||
debugPrint("Updated char: ${character.key}");
|
||||
debugPrint('Updated char: ${character.key}');
|
||||
debugPrint(character.toRawJson());
|
||||
}
|
||||
}
|
||||
@@ -69,9 +69,9 @@ class CharacterService extends GetxService {
|
||||
updateCharacter(
|
||||
Character.empty().copyWith(
|
||||
key: char?.key,
|
||||
displayName: "Traveler",
|
||||
displayName: 'Traveler',
|
||||
characterClass:
|
||||
(char?.characterClass ?? CharacterClass.empty()).copyInheritedWith(name: "Druid"),
|
||||
(char?.characterClass ?? CharacterClass.empty()).copyInheritedWith(name: 'Druid'),
|
||||
stats: (char?.stats ?? CharacterStats(level: 1, currentHp: 20, currentExp: 0, armor: 0))
|
||||
.copyWith(currentExp: Random().nextInt(7)),
|
||||
moves: [
|
||||
@@ -79,24 +79,24 @@ class CharacterService extends GetxService {
|
||||
meta: Meta.version(1),
|
||||
favorited: true,
|
||||
key: 'test_move',
|
||||
name: "Test Move",
|
||||
name: 'Test Move',
|
||||
description:
|
||||
"Interdum natoque aptent auctor magna felis libero lectus luctus dictum fermentum,"
|
||||
" massa magnis vitae hendrerit ornare arcu aliquet donec. Ex per duis "
|
||||
"suspendisse litora rutrum etiam praesent facilisi ante sagittis pulvinar, "
|
||||
"lectus elementum lorem diam vel vestibulum fusce erat potenti leo mi, mus "
|
||||
"egestas pretium torquent sociosqu purus hendrerit condimentum dui fermentum.",
|
||||
'Interdum natoque aptent auctor magna felis libero lectus luctus dictum fermentum,'
|
||||
' massa magnis vitae hendrerit ornare arcu aliquet donec. Ex per duis '
|
||||
'suspendisse litora rutrum etiam praesent facilisi ante sagittis pulvinar, '
|
||||
'lectus elementum lorem diam vel vestibulum fusce erat potenti leo mi, mus '
|
||||
'egestas pretium torquent sociosqu purus hendrerit condimentum dui fermentum.',
|
||||
explanation:
|
||||
"Scelerisque finibus arcu torquent montes felis pharetra tincidunt dis gravida "
|
||||
"parturient adipiscing praesent, vehicula porta vel class iaculis semper ac "
|
||||
"tristique lorem velit. Maximus per hendrerit dapibus volutpat non fusce cras, "
|
||||
"pretium malesuada proin molestie tellus sodales aenean dui, senectus convallis "
|
||||
"varius quam fermentum faucibus.",
|
||||
dice: [dw.Dice.fromJson("2d6+DEX")],
|
||||
classKeys: ["druid"],
|
||||
'Scelerisque finibus arcu torquent montes felis pharetra tincidunt dis gravida '
|
||||
'parturient adipiscing praesent, vehicula porta vel class iaculis semper ac '
|
||||
'tristique lorem velit. Maximus per hendrerit dapibus volutpat non fusce cras, '
|
||||
'pretium malesuada proin molestie tellus sodales aenean dui, senectus convallis '
|
||||
'varius quam fermentum faucibus.',
|
||||
dice: [dw.Dice.fromJson('2d6+DEX')],
|
||||
classKeys: ['druid'],
|
||||
tags: [
|
||||
dw.Tag.fromJson({'name': "source", "value": "casraf"}),
|
||||
dw.Tag.fromJson({'name': "language", "value": "EN"})
|
||||
dw.Tag.fromJson({'name': 'source', 'value': 'casraf'}),
|
||||
dw.Tag.fromJson({'name': 'language', 'value': 'EN'})
|
||||
],
|
||||
category: MoveCategory.basic,
|
||||
),
|
||||
@@ -104,24 +104,24 @@ class CharacterService extends GetxService {
|
||||
meta: Meta.version(1),
|
||||
favorited: true,
|
||||
key: 'test_move_2',
|
||||
name: "Test Move 2",
|
||||
name: 'Test Move 2',
|
||||
description:
|
||||
"Nascetur id malesuada nec aenean quam vel sit, at non accumsan sem dolor risus "
|
||||
"pretium eget, elementum curae iaculis eleifend magnis augue. Lectus congue "
|
||||
"pharetra posuere et ultricies laoreet euismod phasellus ridiculus, quisque massa "
|
||||
"tempus fusce mollis fames curabitur arcu, iaculis ornare morbi integer odio "
|
||||
"ullamcorper duis natoque.",
|
||||
'Nascetur id malesuada nec aenean quam vel sit, at non accumsan sem dolor risus '
|
||||
'pretium eget, elementum curae iaculis eleifend magnis augue. Lectus congue '
|
||||
'pharetra posuere et ultricies laoreet euismod phasellus ridiculus, quisque massa '
|
||||
'tempus fusce mollis fames curabitur arcu, iaculis ornare morbi integer odio '
|
||||
'ullamcorper duis natoque.',
|
||||
explanation:
|
||||
"Etiam vulputate montes ullamcorper arcu consectetur turpis fames, nec nunc orci "
|
||||
"ultrices porttitor elementum, primis duis suscipit justo dui tellus. Hendrerit "
|
||||
"pharetra tristique etiam mollis faucibus quam donec enim, ipsum ridiculus augue "
|
||||
"laoreet commodo lacinia placerat bibendum curabitur, porttitor purus nascetur "
|
||||
"vestibulum dis lobortis et.",
|
||||
'Etiam vulputate montes ullamcorper arcu consectetur turpis fames, nec nunc orci '
|
||||
'ultrices porttitor elementum, primis duis suscipit justo dui tellus. Hendrerit '
|
||||
'pharetra tristique etiam mollis faucibus quam donec enim, ipsum ridiculus augue '
|
||||
'laoreet commodo lacinia placerat bibendum curabitur, porttitor purus nascetur '
|
||||
'vestibulum dis lobortis et.',
|
||||
dice: [],
|
||||
classKeys: ["druid"],
|
||||
classKeys: ['druid'],
|
||||
tags: [
|
||||
dw.Tag.fromJson({'name': "source", "value": "casraf"}),
|
||||
dw.Tag.fromJson({'name': "language", "value": "EN"})
|
||||
dw.Tag.fromJson({'name': 'source', 'value': 'casraf'}),
|
||||
dw.Tag.fromJson({'name': 'language', 'value': 'EN'})
|
||||
],
|
||||
category: MoveCategory.advanced1,
|
||||
),
|
||||
@@ -129,88 +129,88 @@ class CharacterService extends GetxService {
|
||||
meta: Meta.version(1),
|
||||
favorited: true,
|
||||
key: 'test_move_3',
|
||||
name: "Test Move 3",
|
||||
name: 'Test Move 3',
|
||||
description:
|
||||
"Magna habitasse vitae netus mattis bibendum pulvinar, feugiat tortor etiam lorem "
|
||||
"ultricies at eget, risus volutpat tellus ornare pharetra. Mi parturient sapien "
|
||||
"sollicitudin proin tincidunt purus duis dictumst, quis dis metus ad nisl tortor "
|
||||
"consequat justo, imperdiet quam felis fermentum class placerat cursus, senectus "
|
||||
"viverra suspendisse lobortis enim nibh pellentesque.",
|
||||
'Magna habitasse vitae netus mattis bibendum pulvinar, feugiat tortor etiam lorem '
|
||||
'ultricies at eget, risus volutpat tellus ornare pharetra. Mi parturient sapien '
|
||||
'sollicitudin proin tincidunt purus duis dictumst, quis dis metus ad nisl tortor '
|
||||
'consequat justo, imperdiet quam felis fermentum class placerat cursus, senectus '
|
||||
'viverra suspendisse lobortis enim nibh pellentesque.',
|
||||
explanation:
|
||||
"Fermentum conubia sit maximus torquent nunc cras primis tempor, eget efficitur "
|
||||
"lobortis convallis libero turpis commodo laoreet praesent, phasellus imperdiet "
|
||||
"elit facilisi hendrerit est lacinia. Eget condimentum nulla diam nullam mauris "
|
||||
"magnis odio, sodales dolor bibendum quam porta adipiscing.",
|
||||
'Fermentum conubia sit maximus torquent nunc cras primis tempor, eget efficitur '
|
||||
'lobortis convallis libero turpis commodo laoreet praesent, phasellus imperdiet '
|
||||
'elit facilisi hendrerit est lacinia. Eget condimentum nulla diam nullam mauris '
|
||||
'magnis odio, sodales dolor bibendum quam porta adipiscing.',
|
||||
dice: [],
|
||||
classKeys: ["druid"],
|
||||
classKeys: ['druid'],
|
||||
tags: [
|
||||
dw.Tag.fromJson({'name': "source", "value": "casraf"}),
|
||||
dw.Tag.fromJson({'name': "language", "value": "EN"})
|
||||
dw.Tag.fromJson({'name': 'source', 'value': 'casraf'}),
|
||||
dw.Tag.fromJson({'name': 'language', 'value': 'EN'})
|
||||
],
|
||||
category: MoveCategory.special,
|
||||
),
|
||||
],
|
||||
spells: [
|
||||
Spell(
|
||||
key: "test_spell_1",
|
||||
name: "Test Spell 1",
|
||||
key: 'test_spell_1',
|
||||
name: 'Test Spell 1',
|
||||
meta: Meta.version(1),
|
||||
description: "Facilisis tincidunt inceptos habitant dis aptent mattis hendrerit nisi "
|
||||
"cursus, maximus at hac sem aliquet dui fringilla platea fames tortor, dictum integer "
|
||||
"mauris erat sagittis magna accumsan morbi. Ornare class viverra cubilia ridiculus "
|
||||
"cras inceptos montes nisl congue maecenas rutrum, nascetur mattis dignissim porttitor "
|
||||
"praesent adipiscing sed odio non auctor.",
|
||||
explanation: "Per elementum quisque habitasse malesuada eleifend porttitor "
|
||||
"tincidunt pellentesque est, nisi felis class habitant tristique metus finibus. "
|
||||
"Lobortis nullam egestas arcu faucibus malesuada nunc congue, luctus pharetra leo "
|
||||
"hendrerit cubilia purus libero nisl, habitant in duis diam inceptos nec.",
|
||||
description: 'Facilisis tincidunt inceptos habitant dis aptent mattis hendrerit nisi '
|
||||
'cursus, maximus at hac sem aliquet dui fringilla platea fames tortor, dictum integer '
|
||||
'mauris erat sagittis magna accumsan morbi. Ornare class viverra cubilia ridiculus '
|
||||
'cras inceptos montes nisl congue maecenas rutrum, nascetur mattis dignissim porttitor '
|
||||
'praesent adipiscing sed odio non auctor.',
|
||||
explanation: 'Per elementum quisque habitasse malesuada eleifend porttitor '
|
||||
'tincidunt pellentesque est, nisi felis class habitant tristique metus finibus. '
|
||||
'Lobortis nullam egestas arcu faucibus malesuada nunc congue, luctus pharetra leo '
|
||||
'hendrerit cubilia purus libero nisl, habitant in duis diam inceptos nec.',
|
||||
tags: [
|
||||
dw.Tag.fromJson({'name': "source", "value": "casraf"}),
|
||||
dw.Tag.fromJson({'name': "language", "value": "EN"})
|
||||
dw.Tag.fromJson({'name': 'source', 'value': 'casraf'}),
|
||||
dw.Tag.fromJson({'name': 'language', 'value': 'EN'})
|
||||
],
|
||||
dice: [dw.Dice.fromJson("1d4")],
|
||||
dice: [dw.Dice.fromJson('1d4')],
|
||||
classKeys: ['druid'],
|
||||
prepared: true,
|
||||
),
|
||||
Spell(
|
||||
key: "test_spell_2",
|
||||
name: "Test Spell 2",
|
||||
key: 'test_spell_2',
|
||||
name: 'Test Spell 2',
|
||||
meta: Meta.version(1),
|
||||
description: "Facilisis tincidunt inceptos habitant dis aptent mattis hendrerit nisi "
|
||||
"cursus, maximus at hac sem aliquet dui fringilla platea fames tortor, dictum integer "
|
||||
"mauris erat sagittis magna accumsan morbi. Ornare class viverra cubilia ridiculus "
|
||||
"cras inceptos montes nisl congue maecenas rutrum, nascetur mattis dignissim porttitor "
|
||||
"praesent adipiscing sed odio non auctor.",
|
||||
explanation: "Per elementum quisque habitasse malesuada eleifend porttitor "
|
||||
"tincidunt pellentesque est, nisi felis class habitant tristique metus finibus. "
|
||||
"Lobortis nullam egestas arcu faucibus malesuada nunc congue, luctus pharetra leo "
|
||||
"hendrerit cubilia purus libero nisl, habitant in duis diam inceptos nec.",
|
||||
description: 'Facilisis tincidunt inceptos habitant dis aptent mattis hendrerit nisi '
|
||||
'cursus, maximus at hac sem aliquet dui fringilla platea fames tortor, dictum integer '
|
||||
'mauris erat sagittis magna accumsan morbi. Ornare class viverra cubilia ridiculus '
|
||||
'cras inceptos montes nisl congue maecenas rutrum, nascetur mattis dignissim porttitor '
|
||||
'praesent adipiscing sed odio non auctor.',
|
||||
explanation: 'Per elementum quisque habitasse malesuada eleifend porttitor '
|
||||
'tincidunt pellentesque est, nisi felis class habitant tristique metus finibus. '
|
||||
'Lobortis nullam egestas arcu faucibus malesuada nunc congue, luctus pharetra leo '
|
||||
'hendrerit cubilia purus libero nisl, habitant in duis diam inceptos nec.',
|
||||
tags: [
|
||||
dw.Tag.fromJson({'name': "source", "value": "casraf"}),
|
||||
dw.Tag.fromJson({'name': "language", "value": "EN"})
|
||||
dw.Tag.fromJson({'name': 'source', 'value': 'casraf'}),
|
||||
dw.Tag.fromJson({'name': 'language', 'value': 'EN'})
|
||||
],
|
||||
dice: [],
|
||||
classKeys: ['druid'],
|
||||
prepared: true,
|
||||
),
|
||||
Spell(
|
||||
key: "test_spell_3",
|
||||
name: "Test Spell 3",
|
||||
key: 'test_spell_3',
|
||||
name: 'Test Spell 3',
|
||||
meta: Meta.version(1),
|
||||
description: "Facilisis tincidunt inceptos habitant dis aptent mattis hendrerit nisi "
|
||||
"cursus, maximus at hac sem aliquet dui fringilla platea fames tortor, dictum integer "
|
||||
"mauris erat sagittis magna accumsan morbi. Ornare class viverra cubilia ridiculus "
|
||||
"cras inceptos montes nisl congue maecenas rutrum, nascetur mattis dignissim porttitor "
|
||||
"praesent adipiscing sed odio non auctor.",
|
||||
explanation: "Per elementum quisque habitasse malesuada eleifend porttitor "
|
||||
"tincidunt pellentesque est, nisi felis class habitant tristique metus finibus. "
|
||||
"Lobortis nullam egestas arcu faucibus malesuada nunc congue, luctus pharetra leo "
|
||||
"hendrerit cubilia purus libero nisl, habitant in duis diam inceptos nec.",
|
||||
description: 'Facilisis tincidunt inceptos habitant dis aptent mattis hendrerit nisi '
|
||||
'cursus, maximus at hac sem aliquet dui fringilla platea fames tortor, dictum integer '
|
||||
'mauris erat sagittis magna accumsan morbi. Ornare class viverra cubilia ridiculus '
|
||||
'cras inceptos montes nisl congue maecenas rutrum, nascetur mattis dignissim porttitor '
|
||||
'praesent adipiscing sed odio non auctor.',
|
||||
explanation: 'Per elementum quisque habitasse malesuada eleifend porttitor '
|
||||
'tincidunt pellentesque est, nisi felis class habitant tristique metus finibus. '
|
||||
'Lobortis nullam egestas arcu faucibus malesuada nunc congue, luctus pharetra leo '
|
||||
'hendrerit cubilia purus libero nisl, habitant in duis diam inceptos nec.',
|
||||
tags: [
|
||||
dw.Tag.fromJson({'name': "source", "value": "casraf"}),
|
||||
dw.Tag.fromJson({'name': "language", "value": "EN"})
|
||||
dw.Tag.fromJson({'name': 'source', 'value': 'casraf'}),
|
||||
dw.Tag.fromJson({'name': 'language', 'value': 'EN'})
|
||||
],
|
||||
dice: [dw.Dice.fromJson("1d4")],
|
||||
dice: [dw.Dice.fromJson('1d4')],
|
||||
classKeys: ['druid'],
|
||||
prepared: true,
|
||||
),
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'character_service.dart';
|
||||
|
||||
Future<void> initServices() async {
|
||||
print('Starting services...');
|
||||
debugPrint('Starting services...');
|
||||
|
||||
/// Here is where you put get_storage, hive, shared_pref initialization.
|
||||
/// or moor connection, or whatever that's async.
|
||||
await Get.putAsync(() => Future.value(CharacterService().init()));
|
||||
print('All services started');
|
||||
debugPrint('All services started');
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"dynamicCategoriesSpells":
|
||||
MessageLookupByLibrary.simpleMessage("Prepared Spells"),
|
||||
"moveCategory": m2,
|
||||
"quickIconsItems": MessageLookupByLibrary.simpleMessage("Items"),
|
||||
"quickIconsMoves": MessageLookupByLibrary.simpleMessage("Moves"),
|
||||
"quickIconsNote": MessageLookupByLibrary.simpleMessage("+ Note"),
|
||||
"quickIconsSpells": MessageLookupByLibrary.simpleMessage("Spells"),
|
||||
"rollAttackDamageButton":
|
||||
MessageLookupByLibrary.simpleMessage("Attack + Damage"),
|
||||
"rollBasicActionButton":
|
||||
|
||||
@@ -161,6 +161,46 @@ class S {
|
||||
);
|
||||
}
|
||||
|
||||
/// `Items`
|
||||
String get quickIconsItems {
|
||||
return Intl.message(
|
||||
'Items',
|
||||
name: 'quickIconsItems',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Spells`
|
||||
String get quickIconsSpells {
|
||||
return Intl.message(
|
||||
'Spells',
|
||||
name: 'quickIconsSpells',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Moves`
|
||||
String get quickIconsMoves {
|
||||
return Intl.message(
|
||||
'Moves',
|
||||
name: 'quickIconsMoves',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `+ Note`
|
||||
String get quickIconsNote {
|
||||
return Intl.message(
|
||||
'+ Note',
|
||||
name: 'quickIconsNote',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `{alignment, select, chaotic {Chaotic} evil {Evil} good {Good} lawful {Lawful} neutral {Neutral}}`
|
||||
String alignment(Object alignment) {
|
||||
return Intl.select(
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"quickIconsItems": "Items",
|
||||
"quickIconsSpells": "Spells",
|
||||
"quickIconsMoves": "Moves",
|
||||
"quickIconsNote": "+ Note",
|
||||
"alignment": "{alignment, select, chaotic {Chaotic} evil {Evil} good {Good} lawful {Lawful} neutral {Neutral}}",
|
||||
"characterBarHp": "HP",
|
||||
"characterBarXp": "XP",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:dungeon_paper/app/routes/app_pages.dart';
|
||||
import 'package:dungeon_paper/app/widgets/atoms/value_notifier_builder.dart';
|
||||
import 'package:dungeon_paper/core/services/services.dart';
|
||||
import 'package:dungeon_paper/core/shared_preferences.dart';
|
||||
import 'package:dungeon_paper/generated/intl/messages_all.dart';
|
||||
@@ -8,34 +7,31 @@ import 'package:dynamic_themes/dynamic_themes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/route_manager.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
|
||||
import 'app/themes/themes.dart';
|
||||
import 'firebase_options.dart';
|
||||
import 'core/storage_handler/storage_handler.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await initializeMessages('en');
|
||||
await S.load(const Locale("en", "US"));
|
||||
await S.load(const Locale('en', 'US'));
|
||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||
await loadSharedPrefs();
|
||||
Wakelock.toggle(enable: true);
|
||||
await initServices();
|
||||
runApp(MyApp());
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
MyApp({Key? key}) : super(key: key);
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DynamicTheme(
|
||||
themeCollection: themeCollection,
|
||||
defaultThemeId: prefs.getInt("selectedThemeId")!,
|
||||
defaultThemeId: prefs.getInt('selectedThemeId')!,
|
||||
builder: (context, value) {
|
||||
// key: Key(DynamicTheme.of(context)?.themeId.toString() ?? 'none'),
|
||||
return GetMaterialApp(
|
||||
|
||||
@@ -18,7 +18,7 @@ import 'package:intl/src/intl_helpers.dart';
|
||||
|
||||
import 'messages_en.dart' deferred as messages_en;
|
||||
|
||||
typedef Future<dynamic> LibraryLoader();
|
||||
typedef LibraryLoader = Future<dynamic> Function();
|
||||
Map<String, LibraryLoader> _deferredLibraries = {
|
||||
'en': messages_en.loadLibrary,
|
||||
};
|
||||
@@ -35,9 +35,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
|
||||
/// User programs should call this before using [localeName] for messages.
|
||||
Future<bool> initializeMessages(String localeName) async {
|
||||
final availableLocale = Intl.verifiedLocale(
|
||||
localeName,
|
||||
(locale) => _deferredLibraries[locale] != null,
|
||||
onFailure: (_) => null);
|
||||
localeName, (locale) => _deferredLibraries[locale] != null,
|
||||
onFailure: (_) => null);
|
||||
if (availableLocale == null) {
|
||||
return Future.value(false);
|
||||
}
|
||||
@@ -57,8 +56,7 @@ bool _messagesExistFor(String locale) {
|
||||
}
|
||||
|
||||
MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
|
||||
final actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
|
||||
onFailure: (_) => null);
|
||||
final actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
|
||||
if (actualLocale == null) return null;
|
||||
return _findExact(actualLocale);
|
||||
}
|
||||
|
||||
@@ -14,13 +14,11 @@ import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String? messageStr, List<Object>? args);
|
||||
typedef MessageIfAbsent = String Function(String? messageStr, List<Object>? args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'en';
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function> {
|
||||
|
||||
};
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group("Character", () {
|
||||
group('Character', () {
|
||||
expect(true, equals(true));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ void main() {
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user