Skip to content

Commit

Permalink
Feature/flutter 3.22 (#49)
Browse files Browse the repository at this point in the history
* upgrade all platform directories to 3.22

* add generated files

* update packages

* update builder version

* update workflow

* extract deploy job from build job

* remove unused test

* update checkout action to v4

* fix indent

* merge 'repository' task into build task

* fix some lint errors

* check test directory

* add dummy test

* remove optional tasks
  • Loading branch information
reki2000 authored Jun 12, 2024
1 parent 18b2e3e commit 5185f69
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 46 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/github-pages-develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,49 @@ on:
push:
branches:
- 'develop'
pull_request:
branches:
- 'develop'

jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Repository
id: version
run: |
REPOSITORY=$(echo ${{ github.repository }} | sed -e "s#.*/##")
echo ::set-output name=repository::$REPOSITORY
- name: Flutter
- name: Flutter Test / Build
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.3'
flutter-version: '3.22'
channel: 'stable'
cache: true
- run: flutter --version
- run: flutter pub get
- run: flutter test
- run: flutter build web --base-href /${{ steps.version.outputs.repository }}/
- run: |
REPOSITORY=$(echo ${{ github.repository }} | sed -e "s#.*/##")
flutter build web --base-href /$REPOSITORY/
- name: Upload dist as artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: ./build/web

deploy:
runs-on: ubuntu-22.04
needs: build
if: github.ref == 'refs/heads/develop'
steps:
- name: Download dist artifact
uses: actions/download-artifact@v2
with:
name: dist
path: ./build/web

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
4 changes: 2 additions & 2 deletions lib/gui/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'sound_player.dart';

class MyApp extends StatelessWidget {
final String title;
const MyApp({Key? key, required this.title}) : super(key: key);
const MyApp({super.key, required this.title});

@override
Widget build(BuildContext context) {
Expand All @@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
}

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

@override
_MainPageState createState() => _MainPageState();
Expand Down
2 changes: 1 addition & 1 deletion lib/gui/debug/debug_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'vram.dart';
class DebugController extends StatelessWidget {
final NesController controller;

const DebugController({Key? key, required this.controller}) : super(key: key);
const DebugController({super.key, required this.controller});

Widget _button(String text, void Function() func) => Container(
margin:
Expand Down
4 changes: 2 additions & 2 deletions lib/gui/key_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class KeyHandler {
NesPadButton? button = _keys[e.physicalKey];
if (button != null) {
switch (e.runtimeType) {
case KeyDownEvent:
case KeyDownEvent _:
controller.padDown(button);
break;
case KeyUpEvent:
case KeyUpEvent _:
controller.padUp(button);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/gui/nes_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'virtual_pad.dart';
class NesView extends StatefulWidget {
final NesController controller;

const NesView({Key? key, required this.controller}) : super(key: key);
const NesView({super.key, required this.controller});

@override
State<NesView> createState() => _NewViewState();
Expand Down
4 changes: 2 additions & 2 deletions lib/gui/virtual_pad.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class VirtualPadWidget extends StatelessWidget {
final NesController controller;

const VirtualPadWidget({
Key? key,
super.key,
required this.controller,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
29 changes: 1 addition & 28 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:fnesemu/gui/app.dart';

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp(title: "test"));

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
return;
}

0 comments on commit 5185f69

Please sign in to comment.