diff --git a/.gitea/workflows/pull_request.yaml b/.gitea/workflows/pull_request.yaml new file mode 100644 index 0000000..43d36d2 --- /dev/null +++ b/.gitea/workflows/pull_request.yaml @@ -0,0 +1,57 @@ +name: Pull Request Pipeline + +on: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install jq + run: | + apt-get update + apt-get install -y jq + + - name: Install Flutter (wget) + run: | + wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz + tar xf flutter_linux_3.38.2-stable.tar.xz + # Set Git safe directory for Flutter path + git config --global --add safe.directory "$(pwd)/flutter" + # Set Flutter path + echo "$(pwd)/flutter/bin" >> $GITHUB_PATH + + - name: Get dependencies + run: flutter pub get + + - name: Analyze Formatting + run: flutter analyze lib test + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + apt-get update + apt-get install -y jq + + - name: Install Flutter (wget) + run: | + wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz + tar xf flutter_linux_3.38.2-stable.tar.xz + # Set Git safe directory for Flutter path + git config --global --add safe.directory "$(pwd)/flutter" + # Set Flutter path + echo "$(pwd)/flutter/bin" >> $GITHUB_PATH + + - name: Get dependencies + run: flutter pub get + + - name: Run tests + run: flutter test \ No newline at end of file diff --git a/.gitea/workflows/push.yaml b/.gitea/workflows/push.yaml new file mode 100644 index 0000000..700e96b --- /dev/null +++ b/.gitea/workflows/push.yaml @@ -0,0 +1,50 @@ +name: Push Pipeline + +on: + push: + branches: + - "development" + - "main" + +jobs: + format: + runs-on: ubuntu-latest + if: false # Needs bot user + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + apt-get update + apt-get install -y jq + + - name: Install Flutter (wget) + run: | + wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz + tar xf flutter_linux_3.38.2-stable.tar.xz + # Set Git safe directory for Flutter path + git config --global --add safe.directory "$(pwd)/flutter" + # Set Flutter path + echo "$(pwd)/flutter/bin" >> $GITHUB_PATH + + - name: Get & upgrade dependencies + run: | + flutter pub get + flutter pub upgrade --major-versions + + - name: Auto-format + run: | + dart format lib + dart fix --apply lib + + # Needs credentials, push access and the right files need to be staged + - name: Commit Changes + run: | + git config --global user.name "Gitea Actions" + git config --global user.email "actions@gitea.com" + git status + git add lib/ + git status + git commit -m "Actions: Auto-formatting [skip ci]" + git push diff --git a/lib/presentation/views/main_menu/game_history_view.dart b/lib/presentation/views/main_menu/game_history_view.dart index 7c19bbf..a962c05 100644 --- a/lib/presentation/views/main_menu/game_history_view.dart +++ b/lib/presentation/views/main_menu/game_history_view.dart @@ -134,16 +134,16 @@ class _GameHistoryViewState extends State { children: [ Column( children: [ - Container(margin: EdgeInsets.only(bottom: 75)), + Container(margin: const EdgeInsets.only(bottom: 75)), Expanded( child: gameHistoryListView(allGameData, suggestedGameData), ), ], ), Container( - margin: EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), + margin: const EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10), child: SearchBar( - leading: Icon(Icons.search), + leading: const Icon(Icons.search), onChanged: (value) { if (value.isEmpty) { setState(() { @@ -178,16 +178,16 @@ class _GameHistoryViewState extends State { Widget gameHistoryListView(allGameData, suggestedGameData) { if (suggestedGameData.isEmpty && allGameData.isEmpty) { - return TopCenteredMessage( + return const TopCenteredMessage( icon: Icons.info, - title: "Info", - message: "Keine Spiele erstellt", + title: 'Info', + message: 'Keine Spiele erstellt', ); } else if (suggestedGameData.isEmpty) { - return TopCenteredMessage( + return const TopCenteredMessage( icon: Icons.search, - title: "Info", - message: "Kein Spiel mit den Suchparametern gefunden.", + title: 'Info', + message: 'Kein Spiel mit den Suchparametern gefunden.', ); } return ListView.builder( @@ -195,9 +195,9 @@ Widget gameHistoryListView(allGameData, suggestedGameData) { itemBuilder: (context, index) { final currentGame = suggestedGameData[index]; return doubleRowInfoTile( - currentGame['game'] + ": ", + currentGame['game'] + ': ', currentGame['title'], - currentGame['players'].toString() + " Spieler", + "${currentGame['players']} Spieler", currentGame['group'], currentGame['date'], ); diff --git a/lib/presentation/widgets/tiles/double_row_info_tile.dart b/lib/presentation/widgets/tiles/double_row_info_tile.dart index 621cc74..57404ff 100644 --- a/lib/presentation/widgets/tiles/double_row_info_tile.dart +++ b/lib/presentation/widgets/tiles/double_row_info_tile.dart @@ -9,8 +9,8 @@ Widget doubleRowInfoTile( String titleLowerRight, ) { return Container( - margin: EdgeInsets.symmetric(vertical: 5, horizontal: 10), - padding: EdgeInsets.all(10), + margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 10), + padding: const EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: CustomTheme.secondaryColor, @@ -22,18 +22,18 @@ Widget doubleRowInfoTile( Expanded( flex: 10, child: Text( - "$titleOneUpperLeft $titleTwoUpperLeft", - style: TextStyle(fontSize: 20), + '$titleOneUpperLeft $titleTwoUpperLeft', + style: const TextStyle(fontSize: 20), overflow: TextOverflow.ellipsis, maxLines: 1, ), ), - Spacer(), + const Spacer(), Expanded( flex: 3, child: Text( - "$titleUpperRight", - style: TextStyle(fontSize: 20), + titleUpperRight, + style: const TextStyle(fontSize: 20), overflow: TextOverflow.ellipsis, maxLines: 1, textAlign: TextAlign.end, @@ -46,18 +46,18 @@ Widget doubleRowInfoTile( Expanded( flex: 10, child: Text( - "$titleLowerLeft", - style: TextStyle(fontSize: 20), + titleLowerLeft, + style: const TextStyle(fontSize: 20), overflow: TextOverflow.ellipsis, maxLines: 1, ), ), - Spacer(), + const Spacer(), Expanded( flex: 4, child: Text( - "$titleLowerRight", - style: TextStyle(fontSize: 20), + titleLowerRight, + style: const TextStyle(fontSize: 20), overflow: TextOverflow.ellipsis, maxLines: 1, textAlign: TextAlign.end,