mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
BloC
This commit is contained in:
parent
b758deab1a
commit
765d65afd4
6 changed files with 60 additions and 224 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:aidedejeu_flutter/models/items.dart';
|
||||
import 'package:aidedejeu_flutter/theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class _LibraryPageState extends State<LibraryPage> {
|
|||
setState(() {
|
||||
this.item = item;
|
||||
if (item is FilteredItems) {
|
||||
this.filters = (item as FilteredItems).toFilterList();
|
||||
this.filters = item.toFilterList();
|
||||
} else {
|
||||
this.filters = null;
|
||||
}
|
||||
|
|
@ -35,9 +35,9 @@ class _LibraryPageState extends State<LibraryPage> {
|
|||
}
|
||||
|
||||
String markdown = "";
|
||||
Item item = null;
|
||||
Item item;
|
||||
MarkdownStyleSheet styleSheet;
|
||||
List<Filter> filters = null;
|
||||
List<Filter> filters;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
|
|||
|
|
@ -1,127 +1,15 @@
|
|||
import 'package:aidedejeu_flutter/blocs/player_character/player_character_bloc.dart';
|
||||
import 'package:aidedejeu_flutter/database.dart';
|
||||
import 'package:aidedejeu_flutter/localization.dart';
|
||||
import 'package:aidedejeu_flutter/models/items.dart';
|
||||
import 'package:aidedejeu_flutter/theme.dart';
|
||||
import 'package:aidedejeu_flutter/widgets/library.dart';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class PCEditorPage extends StatelessWidget {
|
||||
// StatefulWidget {
|
||||
/* PCEditorPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _PCEditorPageState();
|
||||
}*/
|
||||
/*
|
||||
class PCEditorViewModel {
|
||||
RaceItem _race;
|
||||
SubRaceItem _subRace;
|
||||
List<RaceItem> _races;
|
||||
List<SubRaceItem> _subRaces;
|
||||
|
||||
BackgroundItem _background;
|
||||
SubBackgroundItem _subBackground;
|
||||
List<BackgroundItem> _backgrounds;
|
||||
List<SubBackgroundItem> _subBackgrounds;
|
||||
|
||||
_PCEditorPageState state;
|
||||
BuildContext context;
|
||||
PCEditorViewModel(_PCEditorPageState state, BuildContext context) {
|
||||
this.state = state;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
void _initRaces() async {
|
||||
var races = await loadRaces(context);
|
||||
state.setState(() {
|
||||
_races = races.toList();
|
||||
});
|
||||
}
|
||||
|
||||
void _initSubRaces(RaceItem race) async {
|
||||
var subRaces = await loadSubRaces(context, race);
|
||||
state.setState(() {
|
||||
_subRaces = subRaces;
|
||||
});
|
||||
}
|
||||
|
||||
void _initBackgrounds() async {
|
||||
var backgrounds = await loadBackgrounds(context);
|
||||
state.setState(() {
|
||||
_backgrounds = backgrounds;
|
||||
});
|
||||
}
|
||||
|
||||
void _initSubBackgrounds(BackgroundItem background) async {
|
||||
var subBackgrounds = await loadSubBackgrounds(context, background);
|
||||
state.setState(() {
|
||||
_subBackgrounds = subBackgrounds;
|
||||
});
|
||||
}
|
||||
|
||||
// setters
|
||||
|
||||
void _setRace(RaceItem race) {
|
||||
state.setState(() {
|
||||
this._race = race;
|
||||
this._subRace = null;
|
||||
this._subRaces = null;
|
||||
});
|
||||
_initSubRaces(race);
|
||||
}
|
||||
|
||||
void _setSubRace(SubRaceItem subRace) {
|
||||
state.setState(() {
|
||||
this._subRace = subRace;
|
||||
});
|
||||
}
|
||||
|
||||
void _setBackground(BackgroundItem background) {
|
||||
state.setState(() {
|
||||
this._background = background;
|
||||
this._subBackground = null;
|
||||
this._subBackgrounds = null;
|
||||
});
|
||||
_initSubBackgrounds(background);
|
||||
}
|
||||
|
||||
void _setSubBackground(SubBackgroundItem subBackground) {
|
||||
state.setState(() {
|
||||
this._subBackground = subBackground;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
//class _PCEditorPageState extends State<PCEditorPage> {
|
||||
MarkdownStyleSheet styleSheet;
|
||||
|
||||
//PCEditorViewModel vm;
|
||||
// inits
|
||||
/*
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
//vm = PCEditorViewModel(this, context);
|
||||
//vm._initRaces();
|
||||
//vm._initBackgrounds();
|
||||
}
|
||||
|
||||
@protected
|
||||
@mustCallSuper
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
styleSheet = mainMarkdownStyleSheet(context);
|
||||
}
|
||||
*/
|
||||
// widgets generics
|
||||
|
||||
Widget _buildMarkdown(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue