Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobaraujo7 committed Jan 23, 2024
1 parent 7ef5a64 commit c5e198a
Show file tree
Hide file tree
Showing 18 changed files with 154 additions and 104 deletions.
3 changes: 0 additions & 3 deletions lib/app/(public)/apps_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ class _AppsPageState extends State<AppsPage> {
Navigator.of(context).pop();
}
});

}



@override
void dispose() {
_disposer();
Expand Down
6 changes: 3 additions & 3 deletions lib/app/(public)/config/config_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import '../../interactor/services/gamepad_service.dart';
import 'widgets/about_widget.dart';
import 'widgets/feedback_widget.dart';
import 'widgets/platform_widget.dart';
import 'widgets/settings_widget.dart';
import 'widgets/preferences_widget.dart';

Route routeBuilder(BuildContext context, RouteSettings settings) {
return PageRouteBuilder(
Expand Down Expand Up @@ -89,7 +89,7 @@ class _ConfigPageState extends State<ConfigPage> {
label: Text('feedback'.i18n()),
),
NavigationRailDestination(
icon: Icon(Icons.info_outline),
icon: const Icon(Icons.info_outline),
label: Text('about'.i18n()),
),
],
Expand All @@ -113,7 +113,7 @@ class _ConfigPageState extends State<ConfigPage> {
index: selectedItemIndex,
children: [
PlatformWidget(transitionAnimation: widget.transitionAnimation),
const SettingsWidget(),
const PreferencesWidget(),
FeedbackWidget(),
AboutWidget(),
],
Expand Down
4 changes: 2 additions & 2 deletions lib/app/(public)/config/edit_platform_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ class _EditPlatformPageState extends State<EditPlatformPage> {
const Gap(17),
TextFormField(
key: Key(beautifyPath(platform.folder)),
decoration: InputDecoration(
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: 'folder'.i18n(),
suffixIcon: Icon(Icons.folder),
suffixIcon: const Icon(Icons.folder),
),
initialValue: beautifyPath(platform.folder),
readOnly: true,
Expand Down
5 changes: 3 additions & 2 deletions lib/app/(public)/config/widgets/platform_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _PlatformWidgetState extends State<PlatformWidget> {

return Scaffold(
body: platforms.isEmpty
? Material(
? Material(
child: Center(
child: NoItemWidget(
title: 'no_platforms_found'.i18n(),
Expand All @@ -62,7 +62,8 @@ class _PlatformWidgetState extends State<PlatformWidget> {
if (platform.category.id == 'android') {
playerName = 'Android';
} else {
playerName = platform.player?.app.package ?? 'no_player'.i18n();
playerName =
platform.player?.app.package ?? 'no_player'.i18n();
}
return ListTile(
leading: CircleAvatar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'package:yuno/app/interactor/models/language_model.dart';
import '../../../core/widgets/background/background.dart';
import '../../../interactor/atoms/config_atom.dart';

class SettingsWidget extends StatelessWidget {
const SettingsWidget({super.key});
class PreferencesWidget extends StatelessWidget {
const PreferencesWidget({super.key});

@override
Widget build(BuildContext context) {
Expand Down
9 changes: 6 additions & 3 deletions lib/app/core/assets/sounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import 'package:flutter/services.dart';
import 'package:soundpool/soundpool.dart';
import 'package:yuno/app/interactor/atoms/config_atom.dart';

final _pool = Soundpool.fromOptions(options: const SoundpoolOptions(streamType: StreamType.music));
final _pool = Soundpool.fromOptions(
options: const SoundpoolOptions(streamType: StreamType.music));

const _clickSound = 'assets/sounds/click.mp3';
int _clickSoundId = 0;
Expand Down Expand Up @@ -43,7 +44,8 @@ Future<void> precacheCache() async {
_clickSoundId = await rootBundle.load(_clickSound).then((ByteData soundData) {
return _pool.load(soundData);
});
_doubleSoundId = await rootBundle.load(_doubleSound).then((ByteData soundData) {
_doubleSoundId =
await rootBundle.load(_doubleSound).then((ByteData soundData) {
return _pool.load(soundData);
});
_enterSoundId = await rootBundle.load(_enterSound).then((ByteData soundData) {
Expand All @@ -53,7 +55,8 @@ Future<void> precacheCache() async {
return _pool.load(soundData);
});

_openRailId = await rootBundle.load(_openRailSound).then((ByteData soundData) {
_openRailId =
await rootBundle.load(_openRailSound).then((ByteData soundData) {
return _pool.load(soundData);
});
}
9 changes: 6 additions & 3 deletions lib/app/core/widgets/animated_title_app_bart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class AnimatedTitleAppBar extends StatefulWidget implements PreferredSizeWidget {
class AnimatedTitleAppBar extends StatefulWidget
implements PreferredSizeWidget {
final String title;
final Widget? leading;
final List<Widget> actions;
Expand All @@ -26,7 +27,8 @@ class AnimatedTitleAppBar extends StatefulWidget implements PreferredSizeWidget
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}

class _CustomAppBarState extends State<AnimatedTitleAppBar> with SingleTickerProviderStateMixin {
class _CustomAppBarState extends State<AnimatedTitleAppBar>
with SingleTickerProviderStateMixin {
late final AnimationController controller;
late TextEditingController textEditingController;
var title = '';
Expand All @@ -40,7 +42,8 @@ class _CustomAppBarState extends State<AnimatedTitleAppBar> with SingleTickerPro
vsync: this,
);
controller.addListener(() {
var textoParcial = widget.title.substring(0, (widget.title.length * controller.value).round());
var textoParcial = widget.title
.substring(0, (widget.title.length * controller.value).round());

if (textoParcial != widget.title) {
textoParcial += getRandomCharacter();
Expand Down
28 changes: 13 additions & 15 deletions lib/app/core/widgets/card_tile/card_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ class CardTile extends StatelessWidget {
),
);
}


}

Widget withImage() {
Expand Down Expand Up @@ -121,22 +119,22 @@ class CardTile extends StatelessWidget {
children: [
if (!game.hasImage) Center(child: noImage()),
if (game.isFavorite)
Align(
alignment: Alignment.bottomRight,
child: Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Padding(
padding: const EdgeInsets.all(7.0),
child: SvgPicture.asset(
defaultCategoryFavorite.image,
width: 20,
Align(
alignment: Alignment.bottomRight,
child: Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: Padding(
padding: const EdgeInsets.all(7.0),
child: SvgPicture.asset(
defaultCategoryFavorite.image,
width: 20,
),
),
),
),
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/app/core/widgets/searchable_dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class _SeachItems extends StatefulWidget {
final List<String> items;
final String? label;

const _SeachItems({super.key, required this.items, this.label});
const _SeachItems({required this.items, this.label});

@override
State<_SeachItems> createState() => _SeachItemsState();
Expand Down
5 changes: 4 additions & 1 deletion lib/app/data/repositories/isar/isar_platform_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import 'isar_datasource.dart';
class IsarPlatformRepository extends PlatformRepository {
@override
Future<List<PlatformModel>> fetchPlatforms() async {
final datas = await IsarDatasource.isar.platformDatas.where().sortByCategory().findAll();
final datas = await IsarDatasource.isar.platformDatas
.where()
.sortByCategory()
.findAll();
return datas.map((e) => PlatformAdapter.platformFromData(e)).toList();
}

Expand Down
28 changes: 15 additions & 13 deletions lib/app/data/repositories/uno_sync_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@ class UnoSyncRepository implements SyncRepository {

@override
Future<Game> syncIGDB(Game game) async {

final response = await uno.post('https://api.igdb.com/v4/games',
headers: {
'content-type': 'text/plain',
'client-id': igdbClientId,
'authorization': 'Bearer $igdbToken',
},
data: 'fields artworks,collection,cover.*, first_release_date,genres.*,name,summary; search "${game.name}"; limit 2;',);
final response = await uno.post(
'https://api.igdb.com/v4/games',
headers: {
'content-type': 'text/plain',
'client-id': igdbClientId,
'authorization': 'Bearer $igdbToken',
},
data:
'fields artworks,collection,cover.*, first_release_date,genres.*,name,summary; search "${game.name}"; limit 2;',
);

// prevent multiples calls
await Future.delayed(const Duration(seconds: 1));

if(response.data.isEmpty) {
if (response.data.isEmpty) {
return game;
}

Expand All @@ -39,14 +41,14 @@ class UnoSyncRepository implements SyncRepository {
final dirPath = await pathProvider.getApplicationDocumentsDirectory();
final imageName = basename(image);
final pathSeparator = Platform.pathSeparator;
final imageFile = File('${dirPath.path}${pathSeparator}$imageName');
final imageFile = File('${dirPath.path}$pathSeparator$imageName');

if(!imageFile.existsSync()) {
final imageData = await uno.get(image, responseType: ResponseType.arraybuffer);
if (!imageFile.existsSync()) {
final imageData =
await uno.get(image, responseType: ResponseType.arraybuffer);
await imageFile.writeAsBytes(imageData.data);
}


final metaGame = game.copyWith(
isSynced: true,
description: json['summary'],
Expand Down
2 changes: 1 addition & 1 deletion lib/app/interactor/actions/game_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Future<void> selectCover(Game game) async {
final divide = Platform.pathSeparator;

final imagePath =
'${(await pathProvider.getApplicationDocumentsDirectory()).path}${divide}images${divide}${name}';
'${(await pathProvider.getApplicationDocumentsDirectory()).path}${divide}images$divide$name';
print(imagePath);

final bytes = await file.readAsBytes();
Expand Down
4 changes: 2 additions & 2 deletions lib/app/interactor/models/embeds/game_category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GameCategory {
required this.image,
String? shortName,
this.extensions = const [],
}){
}) {
this.shortName = shortName ?? name;
}

Expand All @@ -22,7 +22,7 @@ class GameCategory {
return true;
}
return extensions //
.any((extension) => name.toLowerCase().endsWith(extension));
.any((extension) => name.toLowerCase().endsWith(extension));
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/app/interactor/repositories/sync_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import 'package:yuno/app/interactor/models/embeds/game.dart';
abstract class SyncRepository {
Future<Game> syncIGDB(Game game);
Future<Game> syncRAWG(Game game);
}
}
76 changes: 38 additions & 38 deletions lib/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,44 @@ import 'app/(public)/home_page.dart' as a3;
import 'app/(public)/splash_page.dart' as a4;

List<RouteEntity> get routes => [
RouteEntity(
key: '/apps',
uri: Uri.parse('/apps'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a0.AppsPage(),
),
),
RouteEntity(
key: '/config',
uri: Uri.parse('/config'),
routeBuilder: a1.routeBuilder,
),
RouteEntity(
key: '/config/edit_platform',
uri: Uri.parse('/config/edit_platform'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a2.EditPlatformPage(),
),
),
RouteEntity(
key: '/home',
uri: Uri.parse('/home'),
routeBuilder: a3.routeBuilder,
),
RouteEntity(
key: '/splash',
uri: Uri.parse('/splash'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a4.AppPage(),
),
),
];
RouteEntity(
key: '/apps',
uri: Uri.parse('/apps'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a0.AppsPage(),
),
),
RouteEntity(
key: '/config',
uri: Uri.parse('/config'),
routeBuilder: a1.routeBuilder,
),
RouteEntity(
key: '/config/edit_platform',
uri: Uri.parse('/config/edit_platform'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a2.EditPlatformPage(),
),
),
RouteEntity(
key: '/home',
uri: Uri.parse('/home'),
routeBuilder: a3.routeBuilder,
),
RouteEntity(
key: '/splash',
uri: Uri.parse('/splash'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a4.AppPage(),
),
),
];

const routePaths = (
path: '/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final String _platformVersion = 'Unknown';

@override
void initState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
(Widget widget) =>
widget is Text && widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
Loading

0 comments on commit c5e198a

Please sign in to comment.