Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions lib/view/pages/badges/achievement_badges.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:gameonconnect/view/pages/models/specific_badge_page.dart';
import 'package:gameonconnect/view/pages/badges/badge_page.dart';

class AchievementBadgesPage extends StatefulWidget {
const AchievementBadgesPage({super.key});
Expand Down Expand Up @@ -40,7 +40,14 @@
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('My Badges'),
iconTheme: IconThemeData(
color: Theme.of(context).colorScheme.primary

Check warning on line 44 in lib/view/pages/badges/achievement_badges.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/achievement_badges.dart#L43-L44

Added lines #L43 - L44 were not covered by tests
),
title: Text('My Badges',
style: TextStyle(

Check warning on line 47 in lib/view/pages/badges/achievement_badges.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/achievement_badges.dart#L46-L47

Added lines #L46 - L47 were not covered by tests
fontWeight: FontWeight.bold,
fontSize: 16,
color: Theme.of(context).colorScheme.primary)),

Check warning on line 50 in lib/view/pages/badges/achievement_badges.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/achievement_badges.dart#L50

Added line #L50 was not covered by tests
),
body: Padding(
padding: const EdgeInsets.all(12),
Expand All @@ -54,10 +61,13 @@
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SpecificBadgePage(badgeName: badges[index] ,badgeFileName: badgeFiles[index])),
);
Navigator.push(

Check warning on line 64 in lib/view/pages/badges/achievement_badges.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/achievement_badges.dart#L64

Added line #L64 was not covered by tests
context,
MaterialPageRoute(
builder: (context) => BadgePage(
badgeName: badges[index],
badgeFileName: badgeFiles[index])),

Check warning on line 69 in lib/view/pages/badges/achievement_badges.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/achievement_badges.dart#L66-L69

Added lines #L66 - L69 were not covered by tests
);
},
child: Container(
decoration: BoxDecoration(
Expand Down
96 changes: 96 additions & 0 deletions lib/view/pages/badges/badge_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import 'package:avatar_stack/avatar_stack.dart';
import 'package:flutter/material.dart';
import 'package:model_viewer_plus/model_viewer_plus.dart';

class BadgePage extends StatefulWidget {
final String badgeFileName;
final String badgeName;
const BadgePage(

Check warning on line 8 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L8

Added line #L8 was not covered by tests
{super.key, required this.badgeFileName, required this.badgeName});

@override
State<BadgePage> createState() => _BadgePageState();

Check warning on line 12 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L11-L12

Added lines #L11 - L12 were not covered by tests
}

class _BadgePageState extends State<BadgePage> {
@override

Check warning on line 16 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L16

Added line #L16 was not covered by tests
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
iconTheme: IconThemeData(
color: Theme.of(context).colorScheme.primary

Check warning on line 21 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L18-L21

Added lines #L18 - L21 were not covered by tests
),
title: Text('My Badges',
style: TextStyle(

Check warning on line 24 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L23-L24

Added lines #L23 - L24 were not covered by tests
fontWeight: FontWeight.bold,
fontSize: 16,
color: Theme.of(context).colorScheme.primary)),

Check warning on line 27 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L27

Added line #L27 was not covered by tests
),
body: Column(children: [
Expanded(
child: ModelViewer(

Check warning on line 31 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L29-L31

Added lines #L29 - L31 were not covered by tests
disablePan: true,
disableZoom: true,
src: 'assets/models/${widget.badgeFileName}.glb',

Check warning on line 34 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L34

Added line #L34 was not covered by tests
alt: 'A 3D model of a badge',
autoRotate: true,
cameraControls: true,
)),
Padding(

Check warning on line 39 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L39

Added line #L39 was not covered by tests
padding: const EdgeInsets.all(12),
child: Divider(
color: Theme.of(context).colorScheme.primaryContainer,

Check warning on line 42 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L41-L42

Added lines #L41 - L42 were not covered by tests
),
),
Text(widget.badgeName,

Check warning on line 45 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L45

Added line #L45 was not covered by tests
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24)),
const SizedBox(height: 18),
const SizedBox(
width: 280,
child: Text(
"You earned this badge by using the app for 10 consecutive days",
style: TextStyle(fontSize: 13, color: Colors.grey),
textAlign: TextAlign.center,
)),
const SizedBox(height: 18),
Row(

Check warning on line 56 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L56

Added line #L56 was not covered by tests
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Earned on:",
style: TextStyle(

Check warning on line 60 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L58-L60

Added lines #L58 - L60 were not covered by tests
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary)),

Check warning on line 62 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L62

Added line #L62 was not covered by tests
const SizedBox(
width: 10,
),
const Text("2024/03/02", style: TextStyle(color: Colors.grey))
],
),
const SizedBox(height: 31),
const Padding(
padding: EdgeInsets.fromLTRB(12, 0, 0, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Also earned by", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15)),
],
),
),
const SizedBox(height: 18),
Padding(

Check warning on line 80 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L80

Added line #L80 was not covered by tests
padding: const EdgeInsets.all(12),
child: AvatarStack(

Check warning on line 82 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L82

Added line #L82 was not covered by tests
width: 250,
height: 50,
borderColor: Theme.of(context).colorScheme.surface,
avatars: [
for (var n = 0; n < 15; n++)
NetworkImage('https://i.pravatar.cc/150?img=$n'),

Check warning on line 88 in lib/view/pages/badges/badge_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/view/pages/badges/badge_page.dart#L85-L88

Added lines #L85 - L88 were not covered by tests
],
),
),
const SizedBox(height: 100)
]),
);
}
}
37 changes: 0 additions & 37 deletions lib/view/pages/models/specific_badge_page.dart

This file was deleted.

2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies:
html_unescape: ^2.0.0
insta_image_viewer: ^1.0.4
youtube_player_flutter: ^9.0.3

avatar_stack: ^1.2.0
flame: ^1.19.0
flame_tiled: ^1.20.3
flame_audio: ^2.10.3
Expand Down
Loading