-
Notifications
You must be signed in to change notification settings - Fork 4
Nollning 26 quest screen #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Knazeball
wants to merge
6
commits into
nollning-2026
Choose a base branch
from
nollning-26-quest-images
base: nollning-2026
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3712a8b
Committing the work so far. This is the new quest screen for nollning…
Knazeball 87cecd0
Fixed wrong order of images. Also did some tidying up with the image …
Knazeball a9cc532
Added clouds at the bottom, changed fonts, centred pixel arts, change…
Knazeball d312318
Reduce pokekort_exkl image size, use week_tracker
georgelgeback a64e69b
Add blocking alert so people cannot enter the unfinished page
georgelgeback c499664
remove setstate
georgelgeback File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,221 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:fsek_mobile/api_client/lib/api_client.dart'; | ||
| import 'package:fsek_mobile/services/api.service.dart'; | ||
| import 'package:fsek_mobile/l10n/app_localizations.dart'; | ||
|
|
||
| class HighscoreScreen extends StatefulWidget { | ||
| final double availableWidth; | ||
| final double availableHeight; | ||
|
|
||
| HighscoreScreen({ | ||
| required this.availableHeight, | ||
| required this.availableWidth, | ||
| }); | ||
|
|
||
| @override | ||
| _HighscoreScreenState createState() => _HighscoreScreenState(); | ||
| } | ||
|
|
||
| class _HighscoreScreenState extends State<HighscoreScreen> { | ||
| Map<NollningGroupRead, int> groupPointsMap = {}; | ||
| NollningRead? nollning; | ||
|
|
||
| String avklarad = "assets/data/nollning_25/uppdrag/bricka-avklarad.png"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should copy required files from nollning_25 to nollning_26 since we're later removing nollning_25 from pubspec? |
||
| String bedomning = "assets/data/nollning_25/uppdrag/bricka-bedomning.png"; | ||
| String misslyckad = "assets/data/nollning_25/uppdrag/bricka-misslyckad.png"; | ||
| String start = "assets/data/nollning_25/uppdrag/bricka-start.png"; | ||
| String rubrik = "assets/data/nollning_25/uppdrag/rubrik.png"; | ||
|
|
||
| @override | ||
| void initState() { | ||
| super.initState(); | ||
| _loadInitData(); | ||
| } | ||
|
|
||
| @override | ||
| void dispose() { | ||
| super.dispose(); | ||
| } | ||
|
|
||
| void _loadInitData() async { | ||
| final nollningResponse = await ApiService.apiClient | ||
| .getNollningApi() | ||
| .nollningGetNollningByYear(year: DateTime.now().year); | ||
| final nollningData = nollningResponse.data; | ||
|
|
||
| if (nollningData != null) { | ||
| List<NollningGroupRead> mentorGroups = nollningData.nollningGroups | ||
| .where((group) => group.group.groupType.name == "mentor") | ||
| .toList(); | ||
| for (final nollningGroup in mentorGroups) { | ||
| final groupMissions = await ApiService.apiClient | ||
| .getNollningApi() | ||
| .nollningGetGroupMissionsFromNollningGroup( | ||
| nollningGroupId: nollningGroup.id, | ||
| ); | ||
|
|
||
| int totalPoints = 0; | ||
| if (groupMissions.data != null && groupMissions.data!.isNotEmpty) { | ||
| for (final gm in groupMissions.data!.toList()) { | ||
| if (gm.isAccepted == "Accepted") { | ||
| totalPoints += gm.points; | ||
| } | ||
| } | ||
| } | ||
| groupPointsMap[nollningGroup] = totalPoints; | ||
| } | ||
| } | ||
|
|
||
| setState(() { | ||
| this.nollning = nollningData; | ||
| }); | ||
| } | ||
|
|
||
| List<Widget> _createHighscoreCards(BuildContext context) { | ||
| var t = AppLocalizations.of(context)!; | ||
| List<Widget> highscoreCards = []; | ||
|
|
||
| Map<NollningGroupRead, int> sortedMap = Map.fromEntries( | ||
| groupPointsMap.entries.toList() | ||
| ..sort((a, b) => b.value.compareTo(a.value)), | ||
| ); | ||
|
|
||
| int pos = 1; | ||
|
|
||
| sortedMap.forEach((key, value) { | ||
| highscoreCards.add(highscoreCard(key, value, pos, context)); | ||
| pos++; | ||
| }); | ||
|
|
||
| return highscoreCards; | ||
| } | ||
|
|
||
| Widget highscoreCard( | ||
| NollningGroupRead group, | ||
| int points, | ||
| int position, | ||
| BuildContext context, | ||
| ) { | ||
| var t = AppLocalizations.of(context)!; | ||
| return Center( | ||
| child: Container( | ||
| height: widget.availableHeight / 15, | ||
| width: widget.availableWidth - 40, | ||
| child: Card( | ||
| shadowColor: Colors.transparent, | ||
| color: Colors.transparent, | ||
| child: Stack( | ||
| children: [ | ||
| Row( | ||
| mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| children: [ | ||
| Center( | ||
| child: Text( | ||
| position.toString(), | ||
| style: TextStyle( | ||
| color: _getPositionColor(position), | ||
| fontFamily: "LoRes12OT", | ||
| fontWeight: FontWeight.w800, | ||
| fontSize: widget.availableWidth / 15, | ||
| ), | ||
| ), | ||
| ), | ||
| Container( | ||
| width: widget.availableWidth / 3, | ||
| height: widget.availableHeight / 10, | ||
| child: Center( | ||
| child: Text( | ||
| textAlign: TextAlign.center, | ||
| group.group.name.length <= 40 | ||
| ? group.group.name | ||
| : group.group.name.substring(0, 20) + "...", | ||
| style: TextStyle( | ||
| fontFamily: "LoRes12OT", | ||
| fontWeight: FontWeight.w600, | ||
| fontSize: group.group.name.length <= 10 | ||
| ? widget.availableWidth / 15 | ||
| : (group.group.name.length <= 20 | ||
| ? widget.availableWidth / 15 | ||
| : widget.availableWidth / 30), | ||
| color: _getPositionColor(position), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| Center( | ||
| child: Text( | ||
| _pointsToString(points), | ||
| style: TextStyle( | ||
| fontFamily: "LoRes12OT", | ||
| fontWeight: FontWeight.normal, | ||
| fontSize: widget.availableWidth / 15, | ||
| color: _getPositionColor(position), | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| var t = AppLocalizations.of(context)!; | ||
|
|
||
| if (this.nollning == null) { | ||
| return Center(child: CircularProgressIndicator()); | ||
| } | ||
|
|
||
| return Container( | ||
| height: widget.availableHeight, | ||
| width: widget.availableWidth, | ||
| child: Stack( | ||
| children: [ | ||
| SingleChildScrollView( | ||
| child: Column( | ||
| children: [ | ||
| Padding( | ||
| padding: EdgeInsets.only(top: widget.availableHeight * 0.01), | ||
| child: Text( | ||
| "HIGH SCORES", | ||
| style: TextStyle( | ||
| fontFamily: "LoRes12OT", | ||
| fontSize: widget.availableWidth / 10, | ||
| color: Colors.white, // justera efter din bakgrund | ||
| ), | ||
| ), | ||
| ), | ||
| ..._createHighscoreCards(context), | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ); | ||
| } | ||
|
|
||
| Color _getPositionColor(int pos) { | ||
| switch (pos % 4) { | ||
| case 0: | ||
| return Colors.indigo; | ||
| case 1: | ||
| return Colors.yellow; | ||
| case 2: | ||
| return Colors.pink; | ||
| default: | ||
| return Colors.cyan; | ||
| } | ||
| } | ||
|
|
||
| String _pointsToString(int points) { | ||
| String pointString = points.toString(); | ||
| while (pointString.length < 6) { | ||
| pointString = "0" + pointString; | ||
| } | ||
| return pointString; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,119 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:fsek_mobile/l10n/app_localizations.dart'; | ||
| import 'package:fsek_mobile/screens/nollning/questscreen_26/highscore.dart'; | ||
| import 'package:fsek_mobile/screens/nollning/questscreen_26/quests.dart'; | ||
|
|
||
| class QuestHomeScreen extends StatefulWidget { | ||
| @override | ||
| _QuestHomeScreenState createState() => _QuestHomeScreenState(); | ||
| } | ||
|
|
||
| class _QuestHomeScreenState extends State<QuestHomeScreen> { | ||
| void initState() { | ||
| super.initState(); | ||
| String rubrik = "assets/data/nollning_26/uppdrag/rubrik1.png"; | ||
| Color backgroundColor = Color(0xFF00487B); | ||
| TabController? _controller; | ||
|
|
||
| void _handleTabChange() { | ||
| setState(() { | ||
| rubrik = _controller!.index == 0 | ||
| ? "assets/data/nollning_26/uppdrag/rubrik1.png" | ||
| : "assets/data/nollning_26/uppdrag/rubrik2.png"; | ||
| backgroundColor = _controller!.index == 0 | ||
| ? Color(0xFF00487B) | ||
| : Colors.black; | ||
| }); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| var t = AppLocalizations.of(context)!; | ||
| void dispose() { | ||
| _controller?.removeListener(_handleTabChange); | ||
| super.dispose(); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| double screenWidth = MediaQuery.of(context).size.width; | ||
| double screenHeight = MediaQuery.of(context).size.height; | ||
|
|
||
| return Scaffold( | ||
| extendBodyBehindAppBar: true, | ||
| appBar: AppBar( | ||
| backgroundColor: Colors.transparent, | ||
| elevation: 0.0, | ||
| scrolledUnderElevation: 0.0, | ||
| ), | ||
| body: InteractiveViewer( | ||
| panEnabled: true, | ||
| child: Container( | ||
| height: screenHeight, | ||
| width: screenWidth, | ||
| child: Align(alignment: Alignment.center, child: Text("Sidequests!")), | ||
| ), | ||
| return DefaultTabController( | ||
| length: 2, | ||
| child: Builder( | ||
| builder: (context) { | ||
| final controller = DefaultTabController.of(context); | ||
| if (_controller != controller) { | ||
| _controller?.removeListener(_handleTabChange); | ||
| _controller = controller; | ||
| _controller?.addListener(_handleTabChange); | ||
| } | ||
| return Scaffold( | ||
| body: Container( | ||
| height: screenHeight, | ||
| width: screenWidth, | ||
| child: Stack( | ||
| children: [ | ||
| Positioned.fill(child: ColoredBox(color: backgroundColor)), | ||
| Column( | ||
| children: [ | ||
| Container( | ||
| width: screenWidth, | ||
| height: screenHeight / 8, | ||
| child: Stack( | ||
| children: [ | ||
| Positioned.fill( | ||
| child: Padding( | ||
| padding: EdgeInsets.only( | ||
| top: screenHeight * 0.03, | ||
| bottom: screenHeight * 0.01, | ||
| ), | ||
| child: Image.asset(rubrik, fit: BoxFit.fill), | ||
| ), | ||
| ), | ||
| Positioned.fill( | ||
| child: Row( | ||
| children: [ | ||
| Expanded( | ||
| child: GestureDetector( | ||
| behavior: HitTestBehavior.opaque, | ||
| onTap: () => _controller?.animateTo(0), | ||
| ), | ||
| ), | ||
| Expanded( | ||
| child: GestureDetector( | ||
| behavior: HitTestBehavior.opaque, | ||
| onTap: () => _controller?.animateTo(1), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| Container( | ||
| width: screenWidth, | ||
| height: screenHeight - (screenHeight / 8), | ||
| child: TabBarView( | ||
| children: [ | ||
| QuestScreen( | ||
| availableHeight: | ||
| screenHeight - (screenHeight / 8), | ||
| availableWidth: screenWidth, | ||
| ), | ||
| HighscoreScreen( | ||
| availableHeight: | ||
| screenHeight - (screenHeight / 8), | ||
| availableWidth: screenWidth, | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The font consolas already exists in the nollning branch.