Skip to content

Commit

Permalink
feat: update to latest flame/flutter (#38)
Browse files Browse the repository at this point in the history
* feat: update to latest flame/flutter

* lint

* lint script

* updating to flame and other deps

* fix release
  • Loading branch information
erickzanardo authored Jun 13, 2023
1 parent e088c32 commit e30edc0
Show file tree
Hide file tree
Showing 40 changed files with 518 additions and 473 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev
- run: flutter config --enable-linux-desktop
- run: flutter build linux
- run: cd packages/combustile_editor && flutter build linux
- run: flutter build linux
- name: Zips the build
uses: papeloto/action-zip@v1
with:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter config --enable-windows-desktop
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
- uses: erickzanardo/flutter-gh-pages@v3
with:
workingDir: fire_atlas_editor
6 changes: 3 additions & 3 deletions fire_atlas_editor/lib/main_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ class FireAtlasApp extends StatelessWidget {
final SlicesStore<FireAtlasState> store;

const FireAtlasApp({
Key? key,
required this.store,
}) : super(key: key);
super.key,
});

@override
Widget build(BuildContext context) {
return SlicesProvider(
store: store,
child: SliceWatcher<FireAtlasState, _FireAtlasAppSlice>(
slicer: (state) => _FireAtlasAppSlice.fromState(state),
slicer: _FireAtlasAppSlice.fromState,
builder: (context, store, slice) {
return MaterialApp(
title: 'Fire Atlas Editor',
Expand Down
14 changes: 7 additions & 7 deletions fire_atlas_editor/lib/screens/editor_screen/editor_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import 'package:flutter/material.dart';
import 'package:slices/slices.dart';

class EditorScreen extends StatelessWidget {
const EditorScreen({Key? key}) : super(key: key);
const EditorScreen({super.key});

@override
Widget build(BuildContext ctx) {
final _store = SlicesProvider.of<FireAtlasState>(ctx);
if (_store.state.currentAtlas == null) {
final store = SlicesProvider.of<FireAtlasState>(ctx);
if (store.state.currentAtlas == null) {
return Scaffold(
body: Center(
child: Column(
Expand All @@ -36,10 +36,10 @@ class EditorScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Body
Expanded(
const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: const [
children: [
Toolbar(),
Expanded(
child: SelectionCanvas(),
Expand All @@ -49,8 +49,8 @@ class EditorScreen extends StatelessWidget {
),
Container(
width: 400,
child: Column(
children: const [
child: const Column(
children: [
Expanded(
flex: 4,
child: Preview(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class AutoMapFontModal extends StatefulWidget {
final Sprite currentSprite;

const AutoMapFontModal({
Key? key,
required this.currentSprite,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() {
Expand All @@ -44,9 +44,9 @@ class _AutoMapFontModalState extends State<AutoMapFontModal> {
void didChangeDependencies() {
super.didChangeDependencies();

final _store = SlicesProvider.of<FireAtlasState>(context);
final store = SlicesProvider.of<FireAtlasState>(context);

final atlas = _store.state.currentAtlas;
final atlas = store.state.currentAtlas;

if (atlas == null) {
throw "Can't map a bitmap font without a atlas selected";
Expand All @@ -56,7 +56,7 @@ class _AutoMapFontModalState extends State<AutoMapFontModal> {
}

void _calculateSelections() {
final _selections = <SpriteSelection>[];
final selections = <SpriteSelection>[];

var x = 0;
var y = 0;
Expand All @@ -79,17 +79,17 @@ class _AutoMapFontModalState extends State<AutoMapFontModal> {

x++;

_selections.add(selection);
selections.add(selection);
});

setState(() {
_currentSelections = _selections;
_currentSelections = selections;
});
}

@override
Widget build(BuildContext context) {
final _store = SlicesProvider.of<FireAtlasState>(context);
final store = SlicesProvider.of<FireAtlasState>(context);
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
Expand Down Expand Up @@ -138,20 +138,20 @@ class _AutoMapFontModalState extends State<AutoMapFontModal> {
FButton(
label: 'Cancel',
onSelect: () {
_store.dispatch(CloseEditorModal());
store.dispatch(CloseEditorModal());
},
),
const SizedBox(width: 20),
FButton(
label: 'Confirm',
selected: true,
onSelect: () {
_store.dispatch(
store.dispatch(
SetSelectionAction.multiple(
selections: _currentSelections,
),
);
_store.dispatch(CloseEditorModal());
store.dispatch(CloseEditorModal());
},
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
import 'package:slices/slices.dart';

class ChangeImageModal extends StatefulWidget {
const ChangeImageModal({Key? key}) : super(key: key);
const ChangeImageModal({super.key});

@override
State createState() => _ChangeImageModalState();
Expand All @@ -20,51 +20,49 @@ class _ChangeImageModalState extends State<ChangeImageModal> {

@override
Widget build(BuildContext ctx) {
final _store = SlicesProvider.of<FireAtlasState>(ctx);
return Container(
child: Column(
children: [
const FSubtitleTitle(title: 'Update image'),
Expanded(
child: ImageSelectionContainer(
margin: const EdgeInsets.all(30),
imageData: _imageData,
onSelectImage: (imageData) {
Flame.images.clearCache();
setState(() {
_imageData = imageData;
});
final store = SlicesProvider.of<FireAtlasState>(ctx);
return Column(
children: [
const FSubtitleTitle(title: 'Update image'),
Expanded(
child: ImageSelectionContainer(
margin: const EdgeInsets.all(30),
imageData: _imageData,
onSelectImage: (imageData) {
Flame.images.clearCache();
setState(() {
_imageData = imageData;
});
},
),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FButton(
label: 'Cancel',
onSelect: () {
store.dispatch(CloseEditorModal());
},
),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FButton(
label: 'Cancel',
onSelect: () {
_store.dispatch(CloseEditorModal());
},
),
FButton(
disabled: _imageData == null,
selected: true,
label: 'Ok',
onSelect: () {
_store.dispatch(CloseEditorModal());
_store.dispatchAsync(
UpdateAtlasImageAction(
imageData: _imageData!,
),
);
},
),
],
),
const SizedBox(height: 20),
],
),
FButton(
disabled: _imageData == null,
selected: true,
label: 'Ok',
onSelect: () {
store.dispatch(CloseEditorModal());
store.dispatchAsync(
UpdateAtlasImageAction(
imageData: _imageData!,
),
);
},
),
],
),
const SizedBox(height: 20),
],
);
}
}
Loading

0 comments on commit e30edc0

Please sign in to comment.