From b718ebbe0ce96053949acbabd4061ffce29fa893 Mon Sep 17 00:00:00 2001 From: thePeras Date: Wed, 7 Aug 2024 13:31:25 +0100 Subject: [PATCH 001/100] Exam Card --- packages/uni_ui/lib/cards/exam_card.dart | 120 ++++++++++++++++++ .../uni_ui/lib/{ => cards}/generic_card.dart | 0 packages/uni_ui/lib/theme.dart | 25 +++- packages/uni_ui/pubspec.lock | 8 ++ packages/uni_ui/pubspec.yaml | 1 + 5 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 packages/uni_ui/lib/cards/exam_card.dart rename packages/uni_ui/lib/{ => cards}/generic_card.dart (100%) diff --git a/packages/uni_ui/lib/cards/exam_card.dart b/packages/uni_ui/lib/cards/exam_card.dart new file mode 100644 index 000000000..3acf18ca5 --- /dev/null +++ b/packages/uni_ui/lib/cards/exam_card.dart @@ -0,0 +1,120 @@ +import 'package:flutter/material.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; +import 'package:uni_ui/cards/generic_card.dart'; +import 'package:uni_ui/theme.dart'; + +class ExamCard extends StatelessWidget { + const ExamCard({ + super.key, + required this.name, + required this.acronym, + required this.rooms, + required this.type, + this.startTime, + this.isInvisible = false, + this.showIcon = true, + this.iconAction, + }); + + final String name; + final String acronym; + final List rooms; + final String type; + final String? startTime; + final bool isInvisible; + final bool showIcon; + final Function()? iconAction; + + @override + Widget build(BuildContext context) { + return Opacity( + opacity: isInvisible ? 0.6 : 1.0, + child: GenericCard( + key: key, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + acronym, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.headlineMedium!, + ), + const SizedBox(width: 8), + Badge( + label: Text(type), + backgroundColor: BadgeColors.er, + textColor: Theme.of(context).colorScheme.surface, + ), + ], + ), + Text( + name, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.titleLarge!, + ), + const SizedBox(height: 5), + Row( + children: [ + PhosphorIcon( + PhosphorIcons.clock(PhosphorIconsStyle.duotone), + color: Theme.of(context).iconTheme.color, + size: 20, + ), + const SizedBox(width: 4), + Text( + startTime ?? "--:--", + style: Theme.of(context).textTheme.bodyMedium!, + ), + const SizedBox(width: 8), + if (!rooms.isEmpty) + PhosphorIcon( + PhosphorIcons.mapPin(PhosphorIconsStyle.duotone), + color: Theme.of(context).iconTheme.color, + size: 20, + ), + const SizedBox(width: 4), + SizedBox( + height: 20, + child: ListView.separated( + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: rooms.length, + separatorBuilder: (context, int index) { + return const SizedBox(width: 4); + }, + itemBuilder: (context, int index) { + return IntrinsicWidth( + child: Text(rooms[index]), + ); + }, + ), + ), + ], + ) + ], + ), + ), + if (showIcon) + IconButton( + onPressed: iconAction ?? () {}, + icon: PhosphorIcon( + isInvisible + ? PhosphorIcons.eye(PhosphorIconsStyle.duotone) + : PhosphorIcons.eyeSlash(PhosphorIconsStyle.duotone), + color: Theme.of(context).iconTheme.color, + size: 35, + ), + ), + ], + ), + ), + ); + } +} diff --git a/packages/uni_ui/lib/generic_card.dart b/packages/uni_ui/lib/cards/generic_card.dart similarity index 100% rename from packages/uni_ui/lib/generic_card.dart rename to packages/uni_ui/lib/cards/generic_card.dart diff --git a/packages/uni_ui/lib/theme.dart b/packages/uni_ui/lib/theme.dart index 02ec51da9..fcf9df238 100644 --- a/packages/uni_ui/lib/theme.dart +++ b/packages/uni_ui/lib/theme.dart @@ -14,6 +14,7 @@ const _textTheme = TextTheme( displayLarge: TextStyle(fontSize: 40, fontWeight: FontWeight.w400), displayMedium: TextStyle(fontSize: 32, fontWeight: FontWeight.w400), displaySmall: TextStyle(fontSize: 28, fontWeight: FontWeight.w400), + headlineLarge: TextStyle(fontSize: 28, fontWeight: FontWeight.w300), headlineMedium: TextStyle(fontSize: 24, fontWeight: FontWeight.w300), headlineSmall: TextStyle(fontSize: 20, fontWeight: FontWeight.w400), titleLarge: TextStyle(fontSize: 18, fontWeight: FontWeight.w300), @@ -24,9 +25,24 @@ const _textTheme = TextTheme( bodySmall: TextStyle(fontSize: 13, fontWeight: FontWeight.w400), ); +var _lightTextTheme = TextTheme( + displayLarge: _textTheme.displayLarge!, + displayMedium: _textTheme.displayMedium!, + displaySmall: _textTheme.displaySmall!, + headlineLarge: _textTheme.headlineLarge!, + headlineMedium: _textTheme.headlineMedium!.copyWith(color: darkRed), + headlineSmall: _textTheme.headlineSmall!, + titleLarge: _textTheme.titleLarge!.copyWith(color: darkRed), + titleMedium: _textTheme.titleMedium!, + titleSmall: _textTheme.titleSmall!, + bodyLarge: _textTheme.bodyLarge!, + bodyMedium: _textTheme.bodyMedium!, + bodySmall: _textTheme.bodySmall!, +); + ThemeData lightTheme = ThemeData( useMaterial3: true, - textTheme: _textTheme, + textTheme: _lightTextTheme, colorScheme: ColorScheme.fromSeed( seedColor: darkRed, surface: mildWhite, @@ -47,3 +63,10 @@ ThemeData lightTheme = ThemeData( indicatorColor: darkRed, iconTheme: const IconThemeData(color: darkRed), ); + +class BadgeColors { + static const mt = Color(0xFF7ca5b8); + static const en = Color(0xFF769c87); + static const er = Color(0xFFab4d39); + static const ee = Color(0xFFfbc11f); +} diff --git a/packages/uni_ui/pubspec.lock b/packages/uni_ui/pubspec.lock index 25a63aad9..1f09ca040 100644 --- a/packages/uni_ui/pubspec.lock +++ b/packages/uni_ui/pubspec.lock @@ -363,6 +363,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + phosphor_flutter: + dependency: "direct main" + description: + name: phosphor_flutter + sha256: "8a14f238f28a0b54842c5a4dc20676598dd4811fcba284ed828bd5a262c11fde" + url: "https://pub.dev" + source: hosted + version: "2.1.0" pool: dependency: transitive description: diff --git a/packages/uni_ui/pubspec.yaml b/packages/uni_ui/pubspec.yaml index 9f518255d..71d7cbb74 100644 --- a/packages/uni_ui/pubspec.yaml +++ b/packages/uni_ui/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: figma_squircle: ^0.5.3 flutter: sdk: flutter + phosphor_flutter: ^2.1.0 dev_dependencies: custom_lint: ^0.6.4 From 2398926d4cc9bd27fcc34baefa1cc3e0c92c9222 Mon Sep 17 00:00:00 2001 From: thePeras Date: Thu, 8 Aug 2024 22:36:05 +0100 Subject: [PATCH 002/100] Services Card --- packages/uni_ui/lib/service_card.dart | 54 +++++++++++++++++++++++++++ packages/uni_ui/pubspec.lock | 8 ++++ packages/uni_ui/pubspec.yaml | 1 + 3 files changed, 63 insertions(+) create mode 100644 packages/uni_ui/lib/service_card.dart diff --git a/packages/uni_ui/lib/service_card.dart b/packages/uni_ui/lib/service_card.dart new file mode 100644 index 000000000..e2c980ef7 --- /dev/null +++ b/packages/uni_ui/lib/service_card.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; +import 'package:uni_ui/generic_card.dart'; + +class ServiceCard extends StatelessWidget { + const ServiceCard({ + super.key, + required this.name, + required this.openingHours, + }); + + final String name; + final List openingHours; + + @override + Widget build(BuildContext context) { + return GenericCard( + key: key, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + name, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.headlineMedium!, + ), + ], + ), + const SizedBox(height: 5), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + PhosphorIcon( + PhosphorIcons.clock(PhosphorIconsStyle.duotone), + color: Theme.of(context).textTheme.bodyMedium!.color, + size: 20, + ), + const SizedBox(width: 5), + Column( + children: [ + for (var i = 0; i < openingHours.length; i++) + Text(openingHours[i], + style: Theme.of(context).textTheme.bodySmall), + ], + ), + ], + ), + ], + ), + ); + } +} diff --git a/packages/uni_ui/pubspec.lock b/packages/uni_ui/pubspec.lock index 25a63aad9..1f09ca040 100644 --- a/packages/uni_ui/pubspec.lock +++ b/packages/uni_ui/pubspec.lock @@ -363,6 +363,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + phosphor_flutter: + dependency: "direct main" + description: + name: phosphor_flutter + sha256: "8a14f238f28a0b54842c5a4dc20676598dd4811fcba284ed828bd5a262c11fde" + url: "https://pub.dev" + source: hosted + version: "2.1.0" pool: dependency: transitive description: diff --git a/packages/uni_ui/pubspec.yaml b/packages/uni_ui/pubspec.yaml index 9f518255d..71d7cbb74 100644 --- a/packages/uni_ui/pubspec.yaml +++ b/packages/uni_ui/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: figma_squircle: ^0.5.3 flutter: sdk: flutter + phosphor_flutter: ^2.1.0 dev_dependencies: custom_lint: ^0.6.4 From 4e87d812bf68fc25696b3dff1e0b735a3fc3e6c3 Mon Sep 17 00:00:00 2001 From: vitormpp Date: Wed, 21 Aug 2024 22:11:06 +0100 Subject: [PATCH 003/100] feat: initial implementation of timeline --- packages/uni_ui/lib/timeline/timeline.dart | 105 +++++++++++++++++++++ packages/uni_ui/pubspec.yaml | 1 + 2 files changed, 106 insertions(+) create mode 100644 packages/uni_ui/lib/timeline/timeline.dart diff --git a/packages/uni_ui/lib/timeline/timeline.dart b/packages/uni_ui/lib/timeline/timeline.dart new file mode 100644 index 000000000..87fd41d88 --- /dev/null +++ b/packages/uni_ui/lib/timeline/timeline.dart @@ -0,0 +1,105 @@ +import 'package:figma_squircle/figma_squircle.dart'; +import 'package:flutter/material.dart'; +import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; + +class Timeline extends StatefulWidget { + const Timeline({ + required this.tabs, + required this.content, + super.key, + }); + + final List tabs; + final List content; + + @override + State createState() => _TimelineState(); +} + +class _TimelineState extends State { + int _currentIndex = 0; + final ItemScrollController _itemScrollController = ItemScrollController(); + final ItemPositionsListener _itemPositionsListener = + ItemPositionsListener.create(); + + @override + void initState() { + super.initState(); + + _itemPositionsListener.itemPositions.addListener(() { + final positions = _itemPositionsListener.itemPositions.value; + if (positions.isNotEmpty) { + final firstVisibleIndex = positions + .where((ItemPosition position) => position.itemLeadingEdge >= 0) + .reduce((ItemPosition current, ItemPosition next) => + current.itemLeadingEdge < next.itemLeadingEdge ? current : next) + .index; + + setState(() { + _currentIndex = firstVisibleIndex; + }); + } + }); + } + + void _onTabTapped(int index) { + setState(() { + _currentIndex = index; + }); + _itemScrollController.scrollTo( + index: index, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: widget.tabs.asMap().entries.map((entry) { + int index = entry.key; + Widget tab = entry.value; + return GestureDetector( + onTap: () => _onTabTapped(index), + child: Padding( + padding: const EdgeInsets.all(7.0), + child: ClipSmoothRect( + radius: SmoothBorderRadius( + cornerRadius: 20, + cornerSmoothing: 1, + ), + child: Container( + padding: const EdgeInsets.symmetric( + vertical: 10.0, horizontal: 15.0), + color: _currentIndex == index + ? Theme.of(context) + .colorScheme + .tertiary + .withOpacity(0.25) + : Colors.transparent, + child: tab, + ), + ), + ), + ); + }).toList(), + ), + ), + Expanded( + child: ScrollablePositionedList.builder( + itemCount: widget.content.length, + itemScrollController: _itemScrollController, + itemPositionsListener: _itemPositionsListener, + itemBuilder: (context, index) { + return widget.content[index]; + }, + ), + ), + ], + ); + } +} diff --git a/packages/uni_ui/pubspec.yaml b/packages/uni_ui/pubspec.yaml index 9f518255d..814c27389 100644 --- a/packages/uni_ui/pubspec.yaml +++ b/packages/uni_ui/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: figma_squircle: ^0.5.3 flutter: sdk: flutter + scrollable_positioned_list: ^0.3.5 dev_dependencies: custom_lint: ^0.6.4 From 102de06267014cf32e50dc0352dffcdc86f89194 Mon Sep 17 00:00:00 2001 From: vitormpp Date: Wed, 28 Aug 2024 23:19:10 +0100 Subject: [PATCH 004/100] feat: scrollable app bar --- packages/uni_ui/lib/main.dart | 329 +++++++++++++++++++++ packages/uni_ui/lib/timeline/timeline.dart | 38 ++- 2 files changed, 360 insertions(+), 7 deletions(-) create mode 100644 packages/uni_ui/lib/main.dart diff --git a/packages/uni_ui/lib/main.dart b/packages/uni_ui/lib/main.dart new file mode 100644 index 000000000..fc1d906a2 --- /dev/null +++ b/packages/uni_ui/lib/main.dart @@ -0,0 +1,329 @@ +import 'package:flutter/material.dart'; +import 'package:uni_ui/timeline/timeline.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + theme: ThemeData.light(), + home: Scaffold( + appBar: AppBar( + title: Text('Timeline Example'), + ), + body: Timeline( + content: [ + Container( + color: Colors.red[100], + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Content for Tab 1', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 8), + Text( + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' + 'Suspendisse eget tincidunt sapien. Phasellus sed ligula id ' + 'turpis vulputate efficitur. Donec ut arcu vel leo blandit ' + 'dictum. Cras ut massa nisi. Nulla facilisi. Quisque porta ' + 'lobortis diam, at interdum orci.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem ' + 'accusantium doloremque laudantium, totam rem aperiam, eaque ' + 'ipsa quae ab illo inventore veritatis et quasi architecto ' + 'beatae vitae dicta sunt explicabo.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'At vero eos et accusamus et iusto odio dignissimos ducimus ' + 'qui blanditiis praesentium voluptatum deleniti atque corrupti ' + 'quos dolores et quas molestias excepturi sint occaecati ' + 'cupiditate non provident.', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + Container( + color: Colors.green[100], + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Content for Tab 2', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 8), + Text( + 'Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut ' + 'odit aut fugit, sed quia consequuntur magni dolores eos qui ' + 'ratione voluptatem sequi nesciunt.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, ' + 'consectetur, adipisci velit, sed quia non numquam eius modi ' + 'tempora incidunt ut labore et dolore magnam aliquam quaerat ' + 'voluptatem.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Ut enim ad minima veniam, quis nostrum exercitationem ullam ' + 'corporis suscipit laboriosam, nisi ut aliquid ex ea commodi ' + 'consequatur?', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + Container( + color: Colors.blue[100], + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Content for Tab 3', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 8), + Text( + 'Quis autem vel eum iure reprehenderit qui in ea voluptate ' + 'velit esse quam nihil molestiae consequatur, vel illum qui ' + 'dolorem eum fugiat quo voluptas nulla pariatur?', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'But I must explain to you how all this mistaken idea of ' + 'denouncing pleasure and praising pain was born and I will ' + 'give you a complete account of the system, and expound the ' + 'actual teachings of the great explorer of the truth.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Nor again is there anyone who loves or pursues or desires to ' + 'obtain pain of itself, because it is pain, but because ' + 'occasionally circumstances occur in which toil and pain can ' + 'procure him some great pleasure.', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + Container( + color: Colors.red[100], + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Content for Tab 4', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 8), + Text( + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' + 'Suspendisse eget tincidunt sapien. Phasellus sed ligula id ' + 'turpis vulputate efficitur. Donec ut arcu vel leo blandit ' + 'dictum. Cras ut massa nisi. Nulla facilisi. Quisque porta ' + 'lobortis diam, at interdum orci.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem ' + 'accusantium doloremque laudantium, totam rem aperiam, eaque ' + 'ipsa quae ab illo inventore veritatis et quasi architecto ' + 'beatae vitae dicta sunt explicabo.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'At vero eos et accusamus et iusto odio dignissimos ducimus ' + 'qui blanditiis praesentium voluptatum deleniti atque corrupti ' + 'quos dolores et quas molestias excepturi sint occaecati ' + 'cupiditate non provident.', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + Container( + color: Colors.red[100], + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Content for Tab 5', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 8), + Text( + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' + 'Suspendisse eget tincidunt sapien. Phasellus sed ligula id ' + 'turpis vulputate efficitur. Donec ut arcu vel leo blandit ' + 'dictum. Cras ut massa nisi. Nulla facilisi. Quisque porta ' + 'lobortis diam, at interdum orci.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem ' + 'accusantium doloremque laudantium, totam rem aperiam, eaque ' + 'ipsa quae ab illo inventore veritatis et quasi architecto ' + 'beatae vitae dicta sunt explicabo.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'At vero eos et accusamus et iusto odio dignissimos ducimus ' + 'qui blanditiis praesentium voluptatum deleniti atque corrupti ' + 'quos dolores et quas molestias excepturi sint occaecati ' + 'cupiditate non provident.', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + Container( + color: Colors.red[100], + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Content for Tab 6', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 8), + Text( + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' + 'Suspendisse eget tincidunt sapien. Phasellus sed ligula id ' + 'turpis vulputate efficitur. Donec ut arcu vel leo blandit ' + 'dictum. Cras ut massa nisi. Nulla facilisi. Quisque porta ' + 'lobortis diam, at interdum orci.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem ' + 'accusantium doloremque laudantium, totam rem aperiam, eaque ' + 'ipsa quae ab illo inventore veritatis et quasi architecto ' + 'beatae vitae dicta sunt explicabo.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'At vero eos et accusamus et iusto odio dignissimos ducimus ' + 'qui blanditiis praesentium voluptatum deleniti atque corrupti ' + 'quos dolores et quas molestias excepturi sint occaecati ' + 'cupiditate non provident.', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + Container( + color: Colors.red[100], + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Content for Tab 7', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + SizedBox(height: 8), + Text( + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' + 'Suspendisse eget tincidunt sapien. Phasellus sed ligula id ' + 'turpis vulputate efficitur. Donec ut arcu vel leo blandit ' + 'dictum. Cras ut massa nisi. Nulla facilisi. Quisque porta ' + 'lobortis diam, at interdum orci.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem ' + 'accusantium doloremque laudantium, totam rem aperiam, eaque ' + 'ipsa quae ab illo inventore veritatis et quasi architecto ' + 'beatae vitae dicta sunt explicabo.', + style: TextStyle(fontSize: 16), + ), + SizedBox(height: 16), + Text( + 'At vero eos et accusamus et iusto odio dignissimos ducimus ' + 'qui blanditiis praesentium voluptatum deleniti atque corrupti ' + 'quos dolores et quas molestias excepturi sint occaecati ' + 'cupiditate non provident.', + style: TextStyle(fontSize: 16), + ), + ], + ), + ), + ], + tabs: [ + Column( + children: [ + Text('Mon'), + Text('1'), + ], + ), + Column( + children: [ + Text('Tue'), + Text('2'), + ], + ), + Column( + children: [ + Text('Wed'), + Text('3'), + ], + ), + Column( + children: [ + Text('Thu'), + Text('4'), + ], + ), + Column( + children: [ + Text('Fri'), + Text('5'), + ], + ), + Column( + children: [ + Text('Sat'), + Text('6'), + ], + ), + Column( + children: [ + Text('Sun'), + Text('7'), + ], + ), + ], + ), + ), + ); + } +} diff --git a/packages/uni_ui/lib/timeline/timeline.dart b/packages/uni_ui/lib/timeline/timeline.dart index 87fd41d88..82c15cd81 100644 --- a/packages/uni_ui/lib/timeline/timeline.dart +++ b/packages/uni_ui/lib/timeline/timeline.dart @@ -21,11 +21,15 @@ class _TimelineState extends State { final ItemScrollController _itemScrollController = ItemScrollController(); final ItemPositionsListener _itemPositionsListener = ItemPositionsListener.create(); + final ScrollController _tabScrollController = ScrollController(); + final List _tabKeys = []; @override void initState() { super.initState(); + _tabKeys.addAll(List.generate(widget.tabs.length, (index) => GlobalKey())); + _itemPositionsListener.itemPositions.addListener(() { final positions = _itemPositionsListener.itemPositions.value; if (positions.isNotEmpty) { @@ -35,22 +39,40 @@ class _TimelineState extends State { current.itemLeadingEdge < next.itemLeadingEdge ? current : next) .index; - setState(() { - _currentIndex = firstVisibleIndex; - }); + if (_currentIndex != firstVisibleIndex) { + setState(() { + _currentIndex = firstVisibleIndex; + }); + + _scrollToCenterTab(firstVisibleIndex); + } } }); } void _onTabTapped(int index) { - setState(() { - _currentIndex = index; - }); _itemScrollController.scrollTo( index: index, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, ); + _scrollToCenterTab(index); + } + + void _scrollToCenterTab(int index) { + final screenWidth = MediaQuery.of(context).size.width; + final RenderBox tabBox = + _tabKeys[index].currentContext!.findRenderObject() as RenderBox; + final tabPosition = tabBox.localToGlobal(Offset.zero); + + final tabWidth = tabBox.size.width; + final offset = tabPosition.dx + (tabWidth / 2) - (screenWidth / 2); + + _tabScrollController.animateTo( + _tabScrollController.offset + offset, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); } @override @@ -59,6 +81,7 @@ class _TimelineState extends State { children: [ SingleChildScrollView( scrollDirection: Axis.horizontal, + controller: _tabScrollController, child: Row( children: widget.tabs.asMap().entries.map((entry) { int index = entry.key; @@ -69,10 +92,11 @@ class _TimelineState extends State { padding: const EdgeInsets.all(7.0), child: ClipSmoothRect( radius: SmoothBorderRadius( - cornerRadius: 20, + cornerRadius: 10, cornerSmoothing: 1, ), child: Container( + key: _tabKeys[index], padding: const EdgeInsets.symmetric( vertical: 10.0, horizontal: 15.0), color: _currentIndex == index From 18420c2fc6cf8771f1aef6a8502740e7a71b4edb Mon Sep 17 00:00:00 2001 From: vitormpp Date: Thu, 29 Aug 2024 16:07:54 +0100 Subject: [PATCH 005/100] fix: add range constraint to tab bar scrolling --- packages/uni_ui/lib/timeline/timeline.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/uni_ui/lib/timeline/timeline.dart b/packages/uni_ui/lib/timeline/timeline.dart index 82c15cd81..e4c2e2a20 100644 --- a/packages/uni_ui/lib/timeline/timeline.dart +++ b/packages/uni_ui/lib/timeline/timeline.dart @@ -63,13 +63,19 @@ class _TimelineState extends State { final screenWidth = MediaQuery.of(context).size.width; final RenderBox tabBox = _tabKeys[index].currentContext!.findRenderObject() as RenderBox; - final tabPosition = tabBox.localToGlobal(Offset.zero); final tabWidth = tabBox.size.width; - final offset = tabPosition.dx + (tabWidth / 2) - (screenWidth / 2); + final offset = (_tabScrollController.offset + + tabBox.localToGlobal(Offset.zero).dx + + (tabWidth / 2) - + (screenWidth / 2)) + .clamp( + 0.0, + _tabScrollController.position.maxScrollExtent, + ); _tabScrollController.animateTo( - _tabScrollController.offset + offset, + offset, duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, ); From 021edc80ea47a7f3bf16d81e85052a56050d78dc Mon Sep 17 00:00:00 2001 From: Rubem Neto Date: Thu, 26 Sep 2024 17:09:32 +0100 Subject: [PATCH 006/100] Course Grade Card --- packages/uni_ui/lib/course_grade_card.dart | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 packages/uni_ui/lib/course_grade_card.dart diff --git a/packages/uni_ui/lib/course_grade_card.dart b/packages/uni_ui/lib/course_grade_card.dart new file mode 100644 index 000000000..0ceb9c263 --- /dev/null +++ b/packages/uni_ui/lib/course_grade_card.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; +import 'package:uni_ui/generic_card.dart'; + +class CourseGradeCard extends StatelessWidget { + const CourseGradeCard( + {required this.courseName, + required this.ects, + required this.grade, + super.key}); + + final String courseName; + final double ects; + final double grade; + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + return GenericCard( + key: key, + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.35, + height: MediaQuery.of(context).size.height * 0.09, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text( + courseName, + style: theme.textTheme.titleLarge?.copyWith( + color: theme.colorScheme.primary, + fontWeight: FontWeight.w600), + overflow: TextOverflow.ellipsis, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "${ects} ECTS", + style: theme.textTheme.bodyLarge + ?.copyWith(color: theme.colorScheme.primary), + ), + Text("${grade.toInt()}", + style: theme.textTheme.bodyLarge + ?.copyWith(color: theme.colorScheme.primary)) + ], + ) + ], + ), + )); + } +} From a0cd2a659f0680ff229267d4a6a1eb297005bd44 Mon Sep 17 00:00:00 2001 From: thePeras Date: Wed, 2 Oct 2024 07:31:21 +0100 Subject: [PATCH 007/100] add Flexible --- packages/uni_ui/lib/cards/exam_card.dart | 119 +++++++++++------------ 1 file changed, 58 insertions(+), 61 deletions(-) diff --git a/packages/uni_ui/lib/cards/exam_card.dart b/packages/uni_ui/lib/cards/exam_card.dart index 3acf18ca5..eaa3d210f 100644 --- a/packages/uni_ui/lib/cards/exam_card.dart +++ b/packages/uni_ui/lib/cards/exam_card.dart @@ -34,72 +34,69 @@ class ExamCard extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - acronym, - overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.headlineMedium!, - ), - const SizedBox(width: 8), - Badge( - label: Text(type), - backgroundColor: BadgeColors.er, - textColor: Theme.of(context).colorScheme.surface, - ), - ], - ), - Text( - name, - overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.titleLarge!, - ), - const SizedBox(height: 5), - Row( - children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + acronym, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.headlineMedium!, + ), + const SizedBox(width: 8), + Badge( + label: Text(type), + backgroundColor: BadgeColors.er, + textColor: Theme.of(context).colorScheme.surface, + ), + ], + ), + Text( + name, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.titleLarge!, + ), + const SizedBox(height: 5), + Row( + children: [ + PhosphorIcon( + PhosphorIcons.clock(PhosphorIconsStyle.duotone), + color: Theme.of(context).iconTheme.color, + size: 20, + ), + const SizedBox(width: 4), + Text( + startTime ?? "--:--", + style: Theme.of(context).textTheme.bodyMedium!, + ), + const SizedBox(width: 8), + if (!rooms.isEmpty) PhosphorIcon( - PhosphorIcons.clock(PhosphorIconsStyle.duotone), + PhosphorIcons.mapPin(PhosphorIconsStyle.duotone), color: Theme.of(context).iconTheme.color, size: 20, ), - const SizedBox(width: 4), - Text( - startTime ?? "--:--", - style: Theme.of(context).textTheme.bodyMedium!, - ), - const SizedBox(width: 8), - if (!rooms.isEmpty) - PhosphorIcon( - PhosphorIcons.mapPin(PhosphorIconsStyle.duotone), - color: Theme.of(context).iconTheme.color, - size: 20, - ), - const SizedBox(width: 4), - SizedBox( - height: 20, - child: ListView.separated( - scrollDirection: Axis.horizontal, - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: rooms.length, - separatorBuilder: (context, int index) { - return const SizedBox(width: 4); - }, - itemBuilder: (context, int index) { - return IntrinsicWidth( - child: Text(rooms[index]), - ); - }, - ), + const SizedBox(width: 4), + SizedBox( + height: 20, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemCount: rooms.length, + separatorBuilder: (context, int index) { + return const SizedBox(width: 4); + }, + itemBuilder: (context, int index) { + return IntrinsicWidth( + child: Text(rooms[index]), + ); + }, ), - ], - ) - ], - ), + ), + ], + ) + ], ), if (showIcon) IconButton( From 4f758e6b45b93e91c528d4d1e2466eff0284c35c Mon Sep 17 00:00:00 2001 From: thePeras Date: Wed, 2 Oct 2024 07:50:53 +0100 Subject: [PATCH 008/100] map iterate --- packages/uni_ui/lib/service_card.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/uni_ui/lib/service_card.dart b/packages/uni_ui/lib/service_card.dart index e2c980ef7..2628c7f1e 100644 --- a/packages/uni_ui/lib/service_card.dart +++ b/packages/uni_ui/lib/service_card.dart @@ -39,12 +39,13 @@ class ServiceCard extends StatelessWidget { ), const SizedBox(width: 5), Column( - children: [ - for (var i = 0; i < openingHours.length; i++) - Text(openingHours[i], - style: Theme.of(context).textTheme.bodySmall), - ], - ), + children: openingHours.map((hour) { + return Text( + hour, + style: Theme.of(context).textTheme.bodySmall, + ); + }).toList(), + ) ], ), ], From 490b8f7fc3723acb14de4a7f32825038b16342d8 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 15:28:09 +0100 Subject: [PATCH 009/100] Create bottom navbar --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 packages/uni_ui/lib/navbar/bottom_navbar.dart diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart new file mode 100644 index 000000000..4af53e821 --- /dev/null +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -0,0 +1,36 @@ +import 'package:figma_squircle/figma_squircle.dart'; +import 'package:flutter/material.dart'; + +class BottomNavbar extends StatelessWidget { + BottomNavbar({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.transparent, + margin: EdgeInsets.all(20), + child: ClipSmoothRect( + radius: SmoothBorderRadius( + cornerRadius: 15, + cornerSmoothing: 1, + ), + child: BottomNavigationBar( + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(Icons.search), + label: 'Search', + ), + BottomNavigationBarItem( + icon: Icon(Icons.settings), + label: 'Settings', + ), + ], + ), + ), + ); + } +} From 65f3d4a66794116d6156ffc08e5911df56631346 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 17:43:45 +0100 Subject: [PATCH 010/100] Create bottom navbar gradients --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 75 +++++++++++++++---- 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 4af53e821..96704547a 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -1,36 +1,79 @@ import 'package:figma_squircle/figma_squircle.dart'; import 'package:flutter/material.dart'; -class BottomNavbar extends StatelessWidget { - BottomNavbar({super.key}); +class _BottomNavbarContainer extends StatelessWidget { + _BottomNavbarContainer({required this.child}); + + final Widget child; @override Widget build(BuildContext context) { return Container( color: Colors.transparent, margin: EdgeInsets.all(20), + height: 80, child: ClipSmoothRect( radius: SmoothBorderRadius( - cornerRadius: 15, + cornerRadius: 20, cornerSmoothing: 1, ), - child: BottomNavigationBar( - items: [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Home', - ), - BottomNavigationBarItem( - icon: Icon(Icons.search), - label: 'Search', + child: Container( + color: Theme.of(context).colorScheme.primary, + child: Container( + decoration: BoxDecoration( + gradient: RadialGradient( + colors: [ + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Colors.transparent, + ], + center: Alignment(-0.5, -1.0), + radius: 3, + ) ), - BottomNavigationBarItem( - icon: Icon(Icons.settings), - label: 'Settings', + child: Container( + decoration: BoxDecoration( + gradient: RadialGradient( + colors: [ + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Colors.transparent, + ], + center: Alignment.bottomRight, + radius: 3, + ) + ), + child: child, ), - ], + ) ), ), ); } } + +class BottomNavbar extends StatelessWidget { + BottomNavbar({super.key}); + + @override + Widget build(BuildContext context) { + return _BottomNavbarContainer( + child: BottomNavigationBar( + backgroundColor: Colors.transparent, + elevation: 0, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(Icons.search), + label: 'Search', + ), + BottomNavigationBarItem( + icon: Icon(Icons.settings), + label: 'Settings', + ), + ], + ), + ); + } +} From f8571522d18766ffad8b835e346931dc8fd6594e Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 18:08:06 +0100 Subject: [PATCH 011/100] Change bottom navbar icons --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 96704547a..50dcac519 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -1,5 +1,6 @@ import 'package:figma_squircle/figma_squircle.dart'; import 'package:flutter/material.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; class _BottomNavbarContainer extends StatelessWidget { _BottomNavbarContainer({required this.child}); @@ -27,7 +28,7 @@ class _BottomNavbarContainer extends StatelessWidget { Colors.transparent, ], center: Alignment(-0.5, -1.0), - radius: 3, + radius: 2.5, ) ), child: Container( @@ -38,7 +39,7 @@ class _BottomNavbarContainer extends StatelessWidget { Colors.transparent, ], center: Alignment.bottomRight, - radius: 3, + radius: 2.5, ) ), child: child, @@ -59,18 +60,49 @@ class BottomNavbar extends StatelessWidget { child: BottomNavigationBar( backgroundColor: Colors.transparent, elevation: 0, + type: BottomNavigationBarType.fixed, + showSelectedLabels: false, + showUnselectedLabels: false, items: [ BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Home', + icon: PhosphorIcon( + PhosphorIcons.house(PhosphorIconsStyle.duotone), + color: Theme.of(context).colorScheme.secondary, + size: 32, + ), + label: '', ), BottomNavigationBarItem( - icon: Icon(Icons.search), - label: 'Search', + icon: PhosphorIcon( + PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone), + color: Theme.of(context).colorScheme.secondary, + size: 32, + ), + label: '', + ), + BottomNavigationBarItem( + icon: PhosphorIcon( + PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone), + color: Theme.of(context).colorScheme.secondary, + size: 32, + ), + label: '', ), BottomNavigationBarItem( - icon: Icon(Icons.settings), - label: 'Settings', + icon: PhosphorIcon( + PhosphorIcons.buildings(PhosphorIconsStyle.duotone), + color: Theme.of(context).colorScheme.secondary, + size: 32, + ), + label: '', + ), + BottomNavigationBarItem( + icon: PhosphorIcon( + PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone), + color: Theme.of(context).colorScheme.secondary, + size: 32, + ), + label: '', ), ], ), From 2cfca6ea97e532bcac2aeac8e524efaa0e7a352b Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 19:11:46 +0100 Subject: [PATCH 012/100] Create BottomNavbarItem --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 51 ++++--------------- .../uni_ui/lib/navbar/bottom_navbar_item.dart | 26 ++++++++++ 2 files changed, 36 insertions(+), 41 deletions(-) create mode 100644 packages/uni_ui/lib/navbar/bottom_navbar_item.dart diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 50dcac519..fa4595011 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -1,6 +1,7 @@ import 'package:figma_squircle/figma_squircle.dart'; import 'package:flutter/material.dart'; import 'package:phosphor_flutter/phosphor_flutter.dart'; +import 'package:uni_ui/navbar/bottom_navbar_item.dart'; class _BottomNavbarContainer extends StatelessWidget { _BottomNavbarContainer({required this.child}); @@ -64,47 +65,15 @@ class BottomNavbar extends StatelessWidget { showSelectedLabels: false, showUnselectedLabels: false, items: [ - BottomNavigationBarItem( - icon: PhosphorIcon( - PhosphorIcons.house(PhosphorIconsStyle.duotone), - color: Theme.of(context).colorScheme.secondary, - size: 32, - ), - label: '', - ), - BottomNavigationBarItem( - icon: PhosphorIcon( - PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone), - color: Theme.of(context).colorScheme.secondary, - size: 32, - ), - label: '', - ), - BottomNavigationBarItem( - icon: PhosphorIcon( - PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone), - color: Theme.of(context).colorScheme.secondary, - size: 32, - ), - label: '', - ), - BottomNavigationBarItem( - icon: PhosphorIcon( - PhosphorIcons.buildings(PhosphorIconsStyle.duotone), - color: Theme.of(context).colorScheme.secondary, - size: 32, - ), - label: '', - ), - BottomNavigationBarItem( - icon: PhosphorIcon( - PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone), - color: Theme.of(context).colorScheme.secondary, - size: 32, - ), - label: '', - ), - ], + PhosphorIcons.house(PhosphorIconsStyle.duotone), + PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone), + PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone), + PhosphorIcons.buildings(PhosphorIconsStyle.duotone), + PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone), + ] + .map((icon) => BottomNavbarItem(icon: icon)) + .map((item) => item.toBottomNavigationBarItem(context)) + .toList(), ), ); } diff --git a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart new file mode 100644 index 000000000..3c536a1d7 --- /dev/null +++ b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; + +class BottomNavbarItem { + BottomNavbarItem({ + required this.icon, + }); + + final IconData icon; + + BottomNavigationBarItem toBottomNavigationBarItem( + BuildContext context, + ) { + return BottomNavigationBarItem( + icon: Container( + padding: EdgeInsets.all(6), + child: PhosphorIcon( + icon, + color: Theme.of(context).colorScheme.secondary, + size: 32, + ), + ), + label: '', + ); + } +} \ No newline at end of file From e259e85f491b135a30541b8e1001ca1a44e55c11 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 19:37:54 +0100 Subject: [PATCH 013/100] Change icon background when selected --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 8 +++++--- packages/uni_ui/lib/navbar/bottom_navbar_item.dart | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index fa4595011..8346c6180 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -62,8 +62,6 @@ class BottomNavbar extends StatelessWidget { backgroundColor: Colors.transparent, elevation: 0, type: BottomNavigationBarType.fixed, - showSelectedLabels: false, - showUnselectedLabels: false, items: [ PhosphorIcons.house(PhosphorIconsStyle.duotone), PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone), @@ -72,8 +70,12 @@ class BottomNavbar extends StatelessWidget { PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone), ] .map((icon) => BottomNavbarItem(icon: icon)) - .map((item) => item.toBottomNavigationBarItem(context)) + .map((item) => item.toBottomNavigationBarItem(context, true)) .toList(), + selectedFontSize: 0, + unselectedFontSize: 0, + showSelectedLabels: false, + showUnselectedLabels: false, ), ); } diff --git a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart index 3c536a1d7..fe1e3ca6e 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart @@ -10,10 +10,15 @@ class BottomNavbarItem { BottomNavigationBarItem toBottomNavigationBarItem( BuildContext context, + bool selected, ) { return BottomNavigationBarItem( icon: Container( padding: EdgeInsets.all(6), + decoration: selected ? BoxDecoration( + color: Theme.of(context).colorScheme.tertiary.withAlpha(0x2f), + borderRadius: BorderRadius.circular(10), + ) : null, child: PhosphorIcon( icon, color: Theme.of(context).colorScheme.secondary, From 29b438f39db20229b67e0d5d72e82a7d7b8afcf7 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 20:08:37 +0100 Subject: [PATCH 014/100] Remove default splash effect --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 43 +++++++++++-------- .../uni_ui/lib/navbar/bottom_navbar_item.dart | 1 - 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 8346c6180..5d5c02d2f 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -58,24 +58,31 @@ class BottomNavbar extends StatelessWidget { @override Widget build(BuildContext context) { return _BottomNavbarContainer( - child: BottomNavigationBar( - backgroundColor: Colors.transparent, - elevation: 0, - type: BottomNavigationBarType.fixed, - items: [ - PhosphorIcons.house(PhosphorIconsStyle.duotone), - PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone), - PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone), - PhosphorIcons.buildings(PhosphorIconsStyle.duotone), - PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone), - ] - .map((icon) => BottomNavbarItem(icon: icon)) - .map((item) => item.toBottomNavigationBarItem(context, true)) - .toList(), - selectedFontSize: 0, - unselectedFontSize: 0, - showSelectedLabels: false, - showUnselectedLabels: false, + child: Theme( + data: Theme.of(context).copyWith( + splashColor: Colors.transparent, + highlightColor: Colors.transparent, + ), + child: BottomNavigationBar( + backgroundColor: Colors.transparent, + elevation: 0, + iconSize: 32, + type: BottomNavigationBarType.fixed, + items: [ + PhosphorIcons.house(PhosphorIconsStyle.duotone), + PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone), + PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone), + PhosphorIcons.buildings(PhosphorIconsStyle.duotone), + PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone), + ] + .map((icon) => BottomNavbarItem(icon: icon)) + .map((item) => item.toBottomNavigationBarItem(context, true)) + .toList(), + selectedFontSize: 0, + unselectedFontSize: 0, + showSelectedLabels: false, + showUnselectedLabels: false, + ), ), ); } diff --git a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart index fe1e3ca6e..f1147954e 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart @@ -22,7 +22,6 @@ class BottomNavbarItem { child: PhosphorIcon( icon, color: Theme.of(context).colorScheme.secondary, - size: 32, ), ), label: '', From 094ba29b1634fb773901bb82749060cc5635d847 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 23:12:50 +0100 Subject: [PATCH 015/100] Implement bottom navbar interactions --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 34 +++++++++++-------- .../uni_ui/lib/navbar/bottom_navbar_item.dart | 11 +++--- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 5d5c02d2f..127eb6f8d 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -1,6 +1,5 @@ import 'package:figma_squircle/figma_squircle.dart'; import 'package:flutter/material.dart'; -import 'package:phosphor_flutter/phosphor_flutter.dart'; import 'package:uni_ui/navbar/bottom_navbar_item.dart'; class _BottomNavbarContainer extends StatelessWidget { @@ -11,7 +10,6 @@ class _BottomNavbarContainer extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - color: Colors.transparent, margin: EdgeInsets.all(20), height: 80, child: ClipSmoothRect( @@ -52,8 +50,24 @@ class _BottomNavbarContainer extends StatelessWidget { } } -class BottomNavbar extends StatelessWidget { - BottomNavbar({super.key}); +class BottomNavbar extends StatefulWidget { + BottomNavbar({super.key, required this.items}); + + final List items; + + @override + _BottomNavbarState createState() => _BottomNavbarState(); +} + +class _BottomNavbarState extends State { + void _refresh() { + setState(() {}); + } + + void _onTap(int index) { + widget.items[index].onTap(); + _refresh(); + } @override Widget build(BuildContext context) { @@ -64,20 +78,12 @@ class BottomNavbar extends StatelessWidget { highlightColor: Colors.transparent, ), child: BottomNavigationBar( + onTap: _onTap, backgroundColor: Colors.transparent, elevation: 0, iconSize: 32, type: BottomNavigationBarType.fixed, - items: [ - PhosphorIcons.house(PhosphorIconsStyle.duotone), - PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone), - PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone), - PhosphorIcons.buildings(PhosphorIconsStyle.duotone), - PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone), - ] - .map((icon) => BottomNavbarItem(icon: icon)) - .map((item) => item.toBottomNavigationBarItem(context, true)) - .toList(), + items: widget.items.map((item) => item.toBottomNavigationBarItem(context)).toList(), selectedFontSize: 0, unselectedFontSize: 0, showSelectedLabels: false, diff --git a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart index f1147954e..46816d6b5 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart @@ -4,18 +4,19 @@ import 'package:phosphor_flutter/phosphor_flutter.dart'; class BottomNavbarItem { BottomNavbarItem({ required this.icon, + required this.isSelected, + required this.onTap, }); final IconData icon; + final bool Function() isSelected; + final void Function() onTap; - BottomNavigationBarItem toBottomNavigationBarItem( - BuildContext context, - bool selected, - ) { + BottomNavigationBarItem toBottomNavigationBarItem(BuildContext context) { return BottomNavigationBarItem( icon: Container( padding: EdgeInsets.all(6), - decoration: selected ? BoxDecoration( + decoration: isSelected() ? BoxDecoration( color: Theme.of(context).colorScheme.tertiary.withAlpha(0x2f), borderRadius: BorderRadius.circular(10), ) : null, From a9bf2870736e400d4dbf2a4717858d7653d7496c Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 23:19:31 +0100 Subject: [PATCH 016/100] Create list of default navbar icons --- packages/uni_ui/lib/navbar/bottom_navbar_item.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart index 46816d6b5..72bee7cf0 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart @@ -1,6 +1,14 @@ import 'package:flutter/material.dart'; import 'package:phosphor_flutter/phosphor_flutter.dart'; +abstract class NavbarDefaultIcons { + static final home = PhosphorIcons.house(PhosphorIconsStyle.duotone); + static final academic = PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone); + static final restaurant = PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone); + static final locations = PhosphorIcons.buildings(PhosphorIconsStyle.duotone); + static final map = PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone); +} + class BottomNavbarItem { BottomNavbarItem({ required this.icon, From 570e8b39df186dce460ce01ce42d2e7ddd4fe52b Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 23:26:27 +0100 Subject: [PATCH 017/100] Fix formatting --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 25 ++++++++++--------- .../uni_ui/lib/navbar/bottom_navbar_item.dart | 15 ++++++----- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 127eb6f8d..342b7cc03 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -28,22 +28,21 @@ class _BottomNavbarContainer extends StatelessWidget { ], center: Alignment(-0.5, -1.0), radius: 2.5, - ) + ), ), child: Container( decoration: BoxDecoration( - gradient: RadialGradient( - colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), - Colors.transparent, - ], - center: Alignment.bottomRight, - radius: 2.5, - ) - ), + gradient: RadialGradient( + colors: [ + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Colors.transparent, + ], + center: Alignment.bottomRight, + radius: 2.5, + )), child: child, ), - ) + ), ), ), ); @@ -83,7 +82,9 @@ class _BottomNavbarState extends State { elevation: 0, iconSize: 32, type: BottomNavigationBarType.fixed, - items: widget.items.map((item) => item.toBottomNavigationBarItem(context)).toList(), + items: widget.items + .map((item) => item.toBottomNavigationBarItem(context)) + .toList(), selectedFontSize: 0, unselectedFontSize: 0, showSelectedLabels: false, diff --git a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart index 72bee7cf0..06b0b620e 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart @@ -3,7 +3,8 @@ import 'package:phosphor_flutter/phosphor_flutter.dart'; abstract class NavbarDefaultIcons { static final home = PhosphorIcons.house(PhosphorIconsStyle.duotone); - static final academic = PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone); + static final academic = + PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone); static final restaurant = PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone); static final locations = PhosphorIcons.buildings(PhosphorIconsStyle.duotone); static final map = PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone); @@ -24,10 +25,12 @@ class BottomNavbarItem { return BottomNavigationBarItem( icon: Container( padding: EdgeInsets.all(6), - decoration: isSelected() ? BoxDecoration( - color: Theme.of(context).colorScheme.tertiary.withAlpha(0x2f), - borderRadius: BorderRadius.circular(10), - ) : null, + decoration: isSelected() + ? BoxDecoration( + color: Theme.of(context).colorScheme.tertiary.withAlpha(0x2f), + borderRadius: BorderRadius.circular(10), + ) + : null, child: PhosphorIcon( icon, color: Theme.of(context).colorScheme.secondary, @@ -36,4 +39,4 @@ class BottomNavbarItem { label: '', ); } -} \ No newline at end of file +} From 759e1a70f2d0f82836d22eb614e9bb66d6996b58 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 23:33:14 +0100 Subject: [PATCH 018/100] Refactor squircle drawing --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 342b7cc03..fc2f5dde7 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -10,39 +10,39 @@ class _BottomNavbarContainer extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.all(20), height: 80, - child: ClipSmoothRect( - radius: SmoothBorderRadius( - cornerRadius: 20, - cornerSmoothing: 1, + margin: EdgeInsets.only(left: 20, right: 20, bottom: 20), + decoration: ShapeDecoration( + color: Theme.of(context).colorScheme.primary, + shape: SmoothRectangleBorder( + borderRadius: SmoothBorderRadius( + cornerRadius: 20, + cornerSmoothing: 1, + ) + ) + ), + child: Container( + decoration: BoxDecoration( + gradient: RadialGradient( + colors: [ + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Colors.transparent, + ], + center: Alignment(-0.5, -1.0), + radius: 2.5, + ), ), child: Container( - color: Theme.of(context).colorScheme.primary, - child: Container( - decoration: BoxDecoration( + decoration: BoxDecoration( gradient: RadialGradient( - colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), - Colors.transparent, - ], - center: Alignment(-0.5, -1.0), - radius: 2.5, - ), - ), - child: Container( - decoration: BoxDecoration( - gradient: RadialGradient( - colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), - Colors.transparent, - ], - center: Alignment.bottomRight, - radius: 2.5, - )), - child: child, - ), - ), + colors: [ + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Colors.transparent, + ], + center: Alignment.bottomRight, + radius: 2.5, + )), + child: child, ), ), ); From a7804d9f3f287933ee94b2a25e52f2cbe48b46df Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 23:39:33 +0100 Subject: [PATCH 019/100] Fix gradient bounds --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index fc2f5dde7..f702773d8 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -21,28 +21,34 @@ class _BottomNavbarContainer extends StatelessWidget { ) ) ), - child: Container( - decoration: BoxDecoration( - gradient: RadialGradient( - colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), - Colors.transparent, - ], - center: Alignment(-0.5, -1.0), - radius: 2.5, - ), + child: ClipSmoothRect( + radius: SmoothBorderRadius( + cornerRadius: 20, + cornerSmoothing: 1, ), child: Container( decoration: BoxDecoration( - gradient: RadialGradient( - colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), - Colors.transparent, - ], - center: Alignment.bottomRight, - radius: 2.5, - )), - child: child, + gradient: RadialGradient( + colors: [ + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Colors.transparent, + ], + center: Alignment(-0.5, -1.0), + radius: 2.5, + ), + ), + child: Container( + decoration: BoxDecoration( + gradient: RadialGradient( + colors: [ + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Colors.transparent, + ], + center: Alignment.bottomRight, + radius: 2.5, + )), + child: child, + ), ), ), ); From 06c717ef503f698b282d463ee0d60fb65a326d40 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Tue, 27 Aug 2024 23:45:19 +0100 Subject: [PATCH 020/100] Apply slight shadow to navbar --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index f702773d8..36cf227c2 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -19,7 +19,14 @@ class _BottomNavbarContainer extends StatelessWidget { cornerRadius: 20, cornerSmoothing: 1, ) - ) + ), + shadows: [ + BoxShadow( + color: Theme.of(context).colorScheme.shadow.withAlpha(0x7f), + blurRadius: 5, + offset: Offset(0, 3), + ), + ], ), child: ClipSmoothRect( radius: SmoothBorderRadius( From 0f0901e3e1f9fbed1ed4e7f2364a1d7def9211ee Mon Sep 17 00:00:00 2001 From: Process-ing Date: Wed, 28 Aug 2024 17:08:20 +0100 Subject: [PATCH 021/100] Add splash effect --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 36cf227c2..c4512141a 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -86,7 +86,7 @@ class _BottomNavbarState extends State { return _BottomNavbarContainer( child: Theme( data: Theme.of(context).copyWith( - splashColor: Colors.transparent, + splashColor: Theme.of(context).colorScheme.tertiary.withAlpha(0x1f), highlightColor: Colors.transparent, ), child: BottomNavigationBar( From 57e343eeecc471f77127e7a3685475cf7d701ccb Mon Sep 17 00:00:00 2001 From: Process-ing Date: Wed, 28 Aug 2024 17:17:34 +0100 Subject: [PATCH 022/100] Improve navbar gradient --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index c4512141a..1ceffd3b5 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -37,10 +37,10 @@ class _BottomNavbarContainer extends StatelessWidget { decoration: BoxDecoration( gradient: RadialGradient( colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Theme.of(context).colorScheme.tertiary.withAlpha(0x4f), Colors.transparent, ], - center: Alignment(-0.5, -1.0), + center: Alignment(-0.5, -1.1), radius: 2.5, ), ), @@ -48,7 +48,7 @@ class _BottomNavbarContainer extends StatelessWidget { decoration: BoxDecoration( gradient: RadialGradient( colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), + Theme.of(context).colorScheme.tertiary.withAlpha(0x4f), Colors.transparent, ], center: Alignment.bottomRight, From 43aa0509abeb080ac6b83ef903622a47632afa59 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Wed, 28 Aug 2024 17:18:05 +0100 Subject: [PATCH 023/100] Fix formatting --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 1ceffd3b5..5c4e419e5 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -15,11 +15,10 @@ class _BottomNavbarContainer extends StatelessWidget { decoration: ShapeDecoration( color: Theme.of(context).colorScheme.primary, shape: SmoothRectangleBorder( - borderRadius: SmoothBorderRadius( - cornerRadius: 20, - cornerSmoothing: 1, - ) - ), + borderRadius: SmoothBorderRadius( + cornerRadius: 20, + cornerSmoothing: 1, + )), shadows: [ BoxShadow( color: Theme.of(context).colorScheme.shadow.withAlpha(0x7f), From 18c313998a31a1e15b2c88ce3d286b3b6f2464b4 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Wed, 28 Aug 2024 17:30:32 +0100 Subject: [PATCH 024/100] Fix gradients (again) --- packages/uni_ui/lib/navbar/bottom_navbar.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar.dart b/packages/uni_ui/lib/navbar/bottom_navbar.dart index 5c4e419e5..da84cc14e 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar.dart @@ -36,7 +36,7 @@ class _BottomNavbarContainer extends StatelessWidget { decoration: BoxDecoration( gradient: RadialGradient( colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x4f), + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), Colors.transparent, ], center: Alignment(-0.5, -1.1), @@ -47,7 +47,7 @@ class _BottomNavbarContainer extends StatelessWidget { decoration: BoxDecoration( gradient: RadialGradient( colors: [ - Theme.of(context).colorScheme.tertiary.withAlpha(0x4f), + Theme.of(context).colorScheme.tertiary.withAlpha(0x3f), Colors.transparent, ], center: Alignment.bottomRight, From 8c6e3cc11907d1115895cab6b363e893fd32f5da Mon Sep 17 00:00:00 2001 From: Process-ing Date: Wed, 11 Sep 2024 19:21:12 +0100 Subject: [PATCH 025/100] Change icon name --- packages/uni_ui/lib/navbar/bottom_navbar_item.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart index 06b0b620e..e34db91bf 100644 --- a/packages/uni_ui/lib/navbar/bottom_navbar_item.dart +++ b/packages/uni_ui/lib/navbar/bottom_navbar_item.dart @@ -6,7 +6,7 @@ abstract class NavbarDefaultIcons { static final academic = PhosphorIcons.graduationCap(PhosphorIconsStyle.duotone); static final restaurant = PhosphorIcons.forkKnife(PhosphorIconsStyle.duotone); - static final locations = PhosphorIcons.buildings(PhosphorIconsStyle.duotone); + static final faculty = PhosphorIcons.buildings(PhosphorIconsStyle.duotone); static final map = PhosphorIcons.mapTrifold(PhosphorIconsStyle.duotone); } From 7b87a4e1fb733c58eaf715126663cfc65d9b9ca5 Mon Sep 17 00:00:00 2001 From: Vitor Pires Date: Wed, 2 Oct 2024 17:08:51 +0100 Subject: [PATCH 026/100] update lock --- packages/uni_ui/pubspec.lock | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/uni_ui/pubspec.lock b/packages/uni_ui/pubspec.lock index 1f09ca040..20675b329 100644 --- a/packages/uni_ui/pubspec.lock +++ b/packages/uni_ui/pubspec.lock @@ -403,6 +403,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.27.7" + scrollable_positioned_list: + dependency: "direct main" + description: + name: scrollable_positioned_list + sha256: "1b54d5f1329a1e263269abc9e2543d90806131aa14fe7c6062a8054d57249287" + url: "https://pub.dev" + source: hosted + version: "0.3.8" shelf: dependency: transitive description: From 699b542d02daeb6538fbd75d80ee9d7f2c9f2434 Mon Sep 17 00:00:00 2001 From: niaefeup-admin Date: Fri, 11 Oct 2024 16:45:43 +0000 Subject: [PATCH 027/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 991f7ea30..95e757be3 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.21+322 +1.10.0-beta.22+324 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index d083fc69b..437b0c037 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.21+322 +version: 1.10.0-beta.22+324 environment: sdk: ">=3.4.0 <4.0.0" From b03d44d3059998d9eeaf11b86eb7105356da550f Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Sat, 12 Oct 2024 20:00:52 +0100 Subject: [PATCH 028/100] Changed LibraryOccupation to sort floors by number when adding a new floor --- packages/uni_app/lib/model/entities/library_occupation.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index 9931652df..fbfad6b43 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -18,7 +18,10 @@ class LibraryOccupation { late List floors; void addFloor(FloorOccupation floor) { - floors.add(floor); + floors + ..add(floor) + ..sort((a, b) => a.number.compareTo(b.number)); + occupation += floor.occupation; capacity += floor.capacity; } From 8a11a691d0704436e05e3a73509ca59394cc69a2 Mon Sep 17 00:00:00 2001 From: Rubem Neto Date: Mon, 14 Oct 2024 14:43:12 +0100 Subject: [PATCH 029/100] Remove copyWith from Course Grade Card --- packages/uni_ui/lib/course_grade_card.dart | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/uni_ui/lib/course_grade_card.dart b/packages/uni_ui/lib/course_grade_card.dart index 0ceb9c263..e004c5ee6 100644 --- a/packages/uni_ui/lib/course_grade_card.dart +++ b/packages/uni_ui/lib/course_grade_card.dart @@ -26,9 +26,7 @@ class CourseGradeCard extends StatelessWidget { children: [ Text( courseName, - style: theme.textTheme.titleLarge?.copyWith( - color: theme.colorScheme.primary, - fontWeight: FontWeight.w600), + style: theme.textTheme.titleLarge, overflow: TextOverflow.ellipsis, ), Row( @@ -37,11 +35,9 @@ class CourseGradeCard extends StatelessWidget { Text( "${ects} ECTS", style: theme.textTheme.bodyLarge - ?.copyWith(color: theme.colorScheme.primary), ), Text("${grade.toInt()}", - style: theme.textTheme.bodyLarge - ?.copyWith(color: theme.colorScheme.primary)) + style: theme.textTheme.bodyLarge) ], ) ], From 19ae1b723d2310dfab32832e0e95ef2ecdb7fc4d Mon Sep 17 00:00:00 2001 From: DGoiana Date: Mon, 14 Oct 2024 16:31:19 +0100 Subject: [PATCH 030/100] fixing casts --- .../parsers/parser_restaurants.dart | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/uni_app/lib/controller/parsers/parser_restaurants.dart b/packages/uni_app/lib/controller/parsers/parser_restaurants.dart index 8a4dc1462..a4c543f70 100644 --- a/packages/uni_app/lib/controller/parsers/parser_restaurants.dart +++ b/packages/uni_app/lib/controller/parsers/parser_restaurants.dart @@ -91,25 +91,30 @@ Restaurant getRestaurantFromGSheets( response.body.indexOf('(') + 1, response.body.lastIndexOf(')'), ); - final parsedJson = - jsonDecode(jsonString) as Map>; + final parsedJson = jsonDecode(jsonString) as Map; final mealsList = []; final format = DateFormat('d/M/y'); - for (final row - in parsedJson['table']?['rows'] as List>) { - final cellList = row['c'] as List>; - if ((cellList[1]['v'] == 'Almoço' && isDinner) || - (cellList[1]['v'] != 'Almoço' && !isDinner)) { + + final table = parsedJson['table'] as Map; + final rows = table['rows'] as List; + + for (final row in rows) { + final cellList = (row as Map)['c'] as List; + if (((cellList[1] as Map)['v'] == 'Almoço' && isDinner) || + ((cellList[1] as Map)['v'] != 'Almoço' && !isDinner)) { continue; } final meal = Meal( - cellList[2]['v'] as String, - cellList[3]['v'] as String, - DayOfWeek.values[format.parseUtc(cellList[0]['f'] as String).weekday - 1], - format.parseUtc(cellList[0]['f'] as String), + (cellList[2] as Map)['v'] as String, + (cellList[3] as Map)['v'] as String, + DayOfWeek.values[format + .parseUtc((cellList[0] as Map)['f'] as String) + .weekday - + 1], + format.parseUtc((cellList[0] as Map)['f'] as String), ); mealsList.add(meal); } From 5874c6fb655736bdf71b4c1bf0cfbb7baba76619 Mon Sep 17 00:00:00 2001 From: thePeras Date: Tue, 15 Oct 2024 13:32:55 +0000 Subject: [PATCH 031/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 95e757be3..fc641a05a 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.22+324 +1.10.0-beta.23+325 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 437b0c037..de121f1b2 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.22+324 +version: 1.10.0-beta.23+325 environment: sdk: ">=3.4.0 <4.0.0" From 00dabc7e7348f04ce4b7689627cc17956b77e1ee Mon Sep 17 00:00:00 2001 From: thePeras Date: Tue, 15 Oct 2024 13:40:20 +0000 Subject: [PATCH 032/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index fc641a05a..a50a5bf62 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.23+325 +1.10.0-beta.24+326 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index de121f1b2..fddc35c89 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.23+325 +version: 1.10.0-beta.24+326 environment: sdk: ">=3.4.0 <4.0.0" From c049396012f1d7ba42fd90329e5dfc6262ec0312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Tue, 15 Oct 2024 10:28:30 +0100 Subject: [PATCH 033/100] fix: logout when OpenID service is unavailable --- .../lib/session/flows/federated/client.dart | 17 ++++++++++ .../session/flows/federated/initiator.dart | 33 +++++++++++++++++-- .../lib/session/flows/federated/request.dart | 32 +++++++++++++----- 3 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 packages/uni_app/lib/session/flows/federated/client.dart diff --git a/packages/uni_app/lib/session/flows/federated/client.dart b/packages/uni_app/lib/session/flows/federated/client.dart new file mode 100644 index 000000000..3079210b1 --- /dev/null +++ b/packages/uni_app/lib/session/flows/federated/client.dart @@ -0,0 +1,17 @@ +import 'package:http/http.dart' as http; +import 'package:uni/http/client/timeout.dart'; + +class FederatedDefaultClient extends http.BaseClient { + FederatedDefaultClient() + : inner = TimeoutClient( + http.Client(), + timeout: const Duration(seconds: 5), + ); + + final http.Client inner; + + @override + Future send(http.BaseRequest request) { + return inner.send(request); + } +} diff --git a/packages/uni_app/lib/session/flows/federated/initiator.dart b/packages/uni_app/lib/session/flows/federated/initiator.dart index 1e7387a0d..11896d702 100644 --- a/packages/uni_app/lib/session/flows/federated/initiator.dart +++ b/packages/uni_app/lib/session/flows/federated/initiator.dart @@ -1,6 +1,11 @@ +import 'dart:async'; + import 'package:http/http.dart' as http; import 'package:openid_client/openid_client.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; +import 'package:uni/session/exception.dart'; import 'package:uni/session/flows/base/initiator.dart'; +import 'package:uni/session/flows/federated/client.dart'; import 'package:uni/session/flows/federated/request.dart'; class FederatedSessionInitiator extends SessionInitiator { @@ -14,11 +19,30 @@ class FederatedSessionInitiator extends SessionInitiator { final String clientId; final Future Function(Flow flow) performAuthentication; + Future _handleOpenIdExceptions( + Future future, { + required AuthenticationException onError, + }) { + T reportExceptionAndFail(E error, StackTrace st) { + unawaited(Sentry.captureException(error, stackTrace: st)); + throw onError; + } + + return future + .onError(reportExceptionAndFail) + .onError(reportExceptionAndFail); + } + @override Future initiate([http.Client? httpClient]) async { - final issuer = await Issuer.discover(realm); - final client = Client(issuer, clientId, httpClient: httpClient); + httpClient ??= FederatedDefaultClient(); + final issuer = await _handleOpenIdExceptions( + Issuer.discover(realm, httpClient: httpClient), + onError: const AuthenticationException('Failed to discover OIDC issuer'), + ); + + final client = Client(issuer, clientId, httpClient: httpClient); final flow = Flow.authorizationCodeWithPKCE( client, scopes: [ @@ -32,7 +56,10 @@ class FederatedSessionInitiator extends SessionInitiator { ); final uri = await performAuthentication(flow); - final credential = await flow.callback(uri.queryParameters); + final credential = await _handleOpenIdExceptions( + flow.callback(uri.queryParameters), + onError: const AuthenticationException('Failed to execute flow callback'), + ); return FederatedSessionRequest(credential: credential); } diff --git a/packages/uni_app/lib/session/flows/federated/request.dart b/packages/uni_app/lib/session/flows/federated/request.dart index 99728aa55..2c619623e 100644 --- a/packages/uni_app/lib/session/flows/federated/request.dart +++ b/packages/uni_app/lib/session/flows/federated/request.dart @@ -1,10 +1,15 @@ +import 'dart:async'; + import 'package:http/http.dart' as http; import 'package:openid_client/openid_client.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni/controller/fetchers/faculties_fetcher.dart'; import 'package:uni/session/exception.dart'; import 'package:uni/session/flows/base/request.dart'; +import 'package:uni/session/flows/federated/client.dart'; import 'package:uni/session/flows/federated/session.dart'; import 'package:uni/sigarra/endpoints/oidc/oidc.dart'; +import 'package:uni/sigarra/endpoints/oidc/token/response.dart'; import 'package:uni/sigarra/options.dart'; class FederatedSessionUserInfo { @@ -38,18 +43,29 @@ class FederatedSessionRequest extends SessionRequest { final Credential credential; + TokenFailedResponse _reportExceptionAndFail( + E error, + StackTrace st, + ) { + unawaited(Sentry.captureException(error, stackTrace: st)); + return const TokenFailedResponse(); + } + @override Future perform([http.Client? httpClient]) async { - final client = httpClient ?? http.Client(); + httpClient ??= FederatedDefaultClient(); - final authorizedClient = credential.createHttpClient(client); + final authorizedClient = credential.createHttpClient(httpClient); final oidc = SigarraOidc(); - final response = await oidc.token.call( - options: BaseRequestOptions( - client: authorizedClient, - ), - ); + final response = await oidc.token + .call( + options: BaseRequestOptions( + client: authorizedClient, + ), + ) + .onError(_reportExceptionAndFail) + .onError(_reportExceptionAndFail); if (!response.success) { throw const AuthenticationException('Failed to get OIDC token'); @@ -65,7 +81,7 @@ class FederatedSessionRequest extends SessionRequest { credential: credential, ); - final faculties = await getStudentFaculties(tempSession, client); + final faculties = await getStudentFaculties(tempSession, httpClient); return FederatedSession( username: userInfo.username, From e7e3f55d9650a81bdd9b62b4bef5dcb802515bc0 Mon Sep 17 00:00:00 2001 From: niaefeup-admin Date: Wed, 16 Oct 2024 10:47:34 +0000 Subject: [PATCH 034/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index a50a5bf62..db9c1f2ef 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.24+326 +1.10.0-beta.25+328 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index fddc35c89..b6691f978 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.24+326 +version: 1.10.0-beta.25+328 environment: sdk: ">=3.4.0 <4.0.0" From 4d8b270bff391e0bf632196e199e0ebd632e3906 Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Wed, 16 Oct 2024 16:03:55 +0100 Subject: [PATCH 035/100] Switch to SplayTreeSet for automatic floor ordering --- .../model/entities/library_occupation.g.dart | 16 +++++------ .../model/entities/library_occupation.dart | 28 +++++++++++++------ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart index fe8e7e4bb..370277fd6 100644 --- a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart +++ b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart @@ -8,24 +8,22 @@ part of '../../../model/entities/library_occupation.dart'; LibraryOccupation _$LibraryOccupationFromJson(Map json) => LibraryOccupation( - json['occupation'] as int, - json['capacity'] as int, - )..floors = (json['floors'] as List) - .map((e) => FloorOccupation.fromJson(e as Map)) - .toList(); + (json['occupation'] as num).toInt(), + (json['capacity'] as num).toInt(), + )..floors = LibraryOccupation._floorsFromJson(json['floors'] as List); Map _$LibraryOccupationToJson(LibraryOccupation instance) => { 'occupation': instance.occupation, 'capacity': instance.capacity, - 'floors': instance.floors, + 'floors': LibraryOccupation._floorsToJson(instance.floors), }; FloorOccupation _$FloorOccupationFromJson(Map json) => FloorOccupation( - json['number'] as int, - json['occupation'] as int, - json['capacity'] as int, + (json['number'] as num).toInt(), + (json['occupation'] as num).toInt(), + (json['capacity'] as num).toInt(), ); Map _$FloorOccupationToJson(FloorOccupation instance) => diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index fbfad6b43..5ad57118e 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -1,4 +1,5 @@ import 'dart:math'; +import 'dart:collection'; import 'package:json_annotation/json_annotation.dart'; @@ -8,20 +9,19 @@ part '../../generated/model/entities/library_occupation.g.dart'; @JsonSerializable() class LibraryOccupation { LibraryOccupation(this.occupation, this.capacity) { - floors = []; + floors = SplayTreeSet((a, b) => a.number.compareTo(b.number)); } factory LibraryOccupation.fromJson(Map json) => _$LibraryOccupationFromJson(json); late int occupation; late int capacity; - late List floors; + + @JsonKey(fromJson: _floorsFromJson, toJson: _floorsToJson) + late SplayTreeSet floors; void addFloor(FloorOccupation floor) { - floors - ..add(floor) - ..sort((a, b) => a.number.compareTo(b.number)); - + floors.add(floor); occupation += floor.occupation; capacity += floor.capacity; } @@ -37,10 +37,22 @@ class LibraryOccupation { if (floors.length < number || number < 0) { return FloorOccupation(0, 0, 0); } - return floors[number - 1]; + return floors.elementAt(number - 1); } Map toJson() => _$LibraryOccupationToJson(this); + + static SplayTreeSet _floorsFromJson(List json) { + var set = SplayTreeSet((a, b) => a.number.compareTo(b.number)); + json.forEach((element) { + set.add(FloorOccupation.fromJson(element as Map)); + }); + return set; + } + + static List> _floorsToJson(SplayTreeSet floors) { + return floors.map((floor) => floor.toJson()).toList(); + } } /// Occupation values of a single floor @@ -62,4 +74,4 @@ class FloorOccupation { } Map toJson() => _$FloorOccupationToJson(this); -} +} \ No newline at end of file From 0e69c84dbfa29bdd3b1192e387c804734a0cc815 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Wed, 16 Oct 2024 22:57:00 +0100 Subject: [PATCH 036/100] modifying ensureInitialized --- .../uni_app/lib/model/providers/state_provider_notifier.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/lib/model/providers/state_provider_notifier.dart b/packages/uni_app/lib/model/providers/state_provider_notifier.dart index 4043391d6..ab2cfade4 100644 --- a/packages/uni_app/lib/model/providers/state_provider_notifier.dart +++ b/packages/uni_app/lib/model/providers/state_provider_notifier.dart @@ -168,9 +168,9 @@ abstract class StateProviderNotifier extends ChangeNotifier { if (!context.mounted || _state != null) { return; } - await _loadFromStorage(context).then((value) { + await _loadFromStorage(context).then((value) async { if (context.mounted) { - _loadFromRemoteFromContext(context); + await _loadFromRemoteFromContext(context); } }); }, From 543d0fca5ccd22356a2b1de30a7d190ec671879b Mon Sep 17 00:00:00 2001 From: DGoiana Date: Wed, 16 Oct 2024 22:21:34 +0000 Subject: [PATCH 037/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index db9c1f2ef..f5d5184dc 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.25+328 +1.10.0-beta.26+329 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index b6691f978..930c0cab0 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.25+328 +version: 1.10.0-beta.26+329 environment: sdk: ">=3.4.0 <4.0.0" From 68d08620da773a0337e476fb574c51164ba50158 Mon Sep 17 00:00:00 2001 From: limwa Date: Sat, 19 Oct 2024 14:49:50 +0000 Subject: [PATCH 038/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index f5d5184dc..4011f721f 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.26+329 +1.10.0-beta.27+330 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 930c0cab0..10cf9708d 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.26+329 +version: 1.10.0-beta.27+330 environment: sdk: ">=3.4.0 <4.0.0" From eea2696aa92244781e606a798d2cbc4e53324854 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Sat, 19 Oct 2024 21:39:54 +0000 Subject: [PATCH 039/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 4011f721f..29135f37b 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.27+330 +1.10.0-beta.28+331 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 10cf9708d..b4f7db5c0 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.27+330 +version: 1.10.0-beta.28+331 environment: sdk: ">=3.4.0 <4.0.0" From 3ce3cca5a741e74a472ee02343ae926293472072 Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Tue, 22 Oct 2024 18:08:20 +0100 Subject: [PATCH 040/100] Revert "Switch to SplayTreeSet for automatic floor ordering" This reverts commit 4d8b270bff391e0bf632196e199e0ebd632e3906. --- .../model/entities/library_occupation.g.dart | 16 ++++++----- .../model/entities/library_occupation.dart | 28 ++++++------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart index 370277fd6..fe8e7e4bb 100644 --- a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart +++ b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart @@ -8,22 +8,24 @@ part of '../../../model/entities/library_occupation.dart'; LibraryOccupation _$LibraryOccupationFromJson(Map json) => LibraryOccupation( - (json['occupation'] as num).toInt(), - (json['capacity'] as num).toInt(), - )..floors = LibraryOccupation._floorsFromJson(json['floors'] as List); + json['occupation'] as int, + json['capacity'] as int, + )..floors = (json['floors'] as List) + .map((e) => FloorOccupation.fromJson(e as Map)) + .toList(); Map _$LibraryOccupationToJson(LibraryOccupation instance) => { 'occupation': instance.occupation, 'capacity': instance.capacity, - 'floors': LibraryOccupation._floorsToJson(instance.floors), + 'floors': instance.floors, }; FloorOccupation _$FloorOccupationFromJson(Map json) => FloorOccupation( - (json['number'] as num).toInt(), - (json['occupation'] as num).toInt(), - (json['capacity'] as num).toInt(), + json['number'] as int, + json['occupation'] as int, + json['capacity'] as int, ); Map _$FloorOccupationToJson(FloorOccupation instance) => diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index 5ad57118e..fbfad6b43 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -1,5 +1,4 @@ import 'dart:math'; -import 'dart:collection'; import 'package:json_annotation/json_annotation.dart'; @@ -9,19 +8,20 @@ part '../../generated/model/entities/library_occupation.g.dart'; @JsonSerializable() class LibraryOccupation { LibraryOccupation(this.occupation, this.capacity) { - floors = SplayTreeSet((a, b) => a.number.compareTo(b.number)); + floors = []; } factory LibraryOccupation.fromJson(Map json) => _$LibraryOccupationFromJson(json); late int occupation; late int capacity; - - @JsonKey(fromJson: _floorsFromJson, toJson: _floorsToJson) - late SplayTreeSet floors; + late List floors; void addFloor(FloorOccupation floor) { - floors.add(floor); + floors + ..add(floor) + ..sort((a, b) => a.number.compareTo(b.number)); + occupation += floor.occupation; capacity += floor.capacity; } @@ -37,22 +37,10 @@ class LibraryOccupation { if (floors.length < number || number < 0) { return FloorOccupation(0, 0, 0); } - return floors.elementAt(number - 1); + return floors[number - 1]; } Map toJson() => _$LibraryOccupationToJson(this); - - static SplayTreeSet _floorsFromJson(List json) { - var set = SplayTreeSet((a, b) => a.number.compareTo(b.number)); - json.forEach((element) { - set.add(FloorOccupation.fromJson(element as Map)); - }); - return set; - } - - static List> _floorsToJson(SplayTreeSet floors) { - return floors.map((floor) => floor.toJson()).toList(); - } } /// Occupation values of a single floor @@ -74,4 +62,4 @@ class FloorOccupation { } Map toJson() => _$FloorOccupationToJson(this); -} \ No newline at end of file +} From fe5618290f83f1ac0955b7d7c0e203cecb499fca Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Tue, 22 Oct 2024 18:56:45 +0100 Subject: [PATCH 041/100] Moved floor sorting to occur after all floors are added in LibraryOccupation --- .../controller/fetchers/library_occupation_fetcher.dart | 3 ++- .../uni_app/lib/model/entities/library_occupation.dart | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart index f0616bd13..34798352c 100644 --- a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart +++ b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart @@ -38,7 +38,8 @@ class LibraryOccupationFetcher { libraryOccupation.addFloor(floorOccupation); }), ); - + + libraryOccupation.sortFloors(); return libraryOccupation; } diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index fbfad6b43..bf6eb0924 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -18,10 +18,7 @@ class LibraryOccupation { late List floors; void addFloor(FloorOccupation floor) { - floors - ..add(floor) - ..sort((a, b) => a.number.compareTo(b.number)); - + floors.add(floor); occupation += floor.occupation; capacity += floor.capacity; } @@ -40,6 +37,10 @@ class LibraryOccupation { return floors[number - 1]; } + void sortFloors(){ + floors.sort((a, b) => a.number.compareTo(b.number)); + } + Map toJson() => _$LibraryOccupationToJson(this); } From 2a4a01303602d70ccbae28832aa34cc6d50ec7cb Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Tue, 22 Oct 2024 19:00:27 +0100 Subject: [PATCH 042/100] Applied Dart formatting --- .../lib/controller/fetchers/library_occupation_fetcher.dart | 2 +- packages/uni_app/lib/model/entities/library_occupation.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart index 34798352c..be22fb683 100644 --- a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart +++ b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart @@ -38,7 +38,7 @@ class LibraryOccupationFetcher { libraryOccupation.addFloor(floorOccupation); }), ); - + libraryOccupation.sortFloors(); return libraryOccupation; } diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index bf6eb0924..cdf692efd 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -37,7 +37,7 @@ class LibraryOccupation { return floors[number - 1]; } - void sortFloors(){ + void sortFloors() { floors.sort((a, b) => a.number.compareTo(b.number)); } From 3873f5bac8a3e6ccdbcd662617850025f182fc7b Mon Sep 17 00:00:00 2001 From: Pratyush Singh <78858764+pratyush-1327@users.noreply.github.com> Date: Wed, 23 Oct 2024 00:03:48 +0530 Subject: [PATCH 043/100] Update .gitignore Added pubspec.lock --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 04c23541d..da15dde4c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ build/ *.bin .flutter-plugins* +packages/uni_ui/pubspec.lock # IDE files .DS_Store From 28f57f64766cda9b4513237ab82776ceac7d1d70 Mon Sep 17 00:00:00 2001 From: thePeras Date: Wed, 23 Oct 2024 09:28:42 +0000 Subject: [PATCH 044/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 29135f37b..5de574a28 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.28+331 +1.10.0-beta.29+332 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index b4f7db5c0..16135fe6d 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.28+331 +version: 1.10.0-beta.29+332 environment: sdk: ">=3.4.0 <4.0.0" From 6c6e66dddb7b62d04ec20d3fcaf2a8d26ae848bc Mon Sep 17 00:00:00 2001 From: DGoiana Date: Thu, 24 Oct 2024 13:38:41 +0000 Subject: [PATCH 045/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 5de574a28..ee405355c 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.29+332 +1.10.0-beta.30+333 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 16135fe6d..020d47c88 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.29+332 +version: 1.10.0-beta.30+333 environment: sdk: ">=3.4.0 <4.0.0" From a4418c8a797ec22d4758a9b6f594b9eae3bbb961 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Thu, 24 Oct 2024 22:18:11 +0100 Subject: [PATCH 046/100] fix: app not closing on the exit dialog --- packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart b/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart index 5454f6e3e..c314a658f 100644 --- a/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart +++ b/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:uni/generated/l10n.dart'; /// Manages the app section displayed when the user presses the back button @@ -36,7 +37,7 @@ class BackButtonExitWrapper extends StatelessWidget { ElevatedButton( onPressed: () { userActionCompleter.complete(true); - Navigator.of(context).pop(false); + SystemChannels.platform.invokeMethod('SystemNavigator.pop'); }, child: Text(S.of(context).yes), ), From 2ff5924c7bb7be13a5fe9442ef1dc23c6a41b162 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Thu, 24 Oct 2024 22:39:15 +0100 Subject: [PATCH 047/100] formatting --- packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart b/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart index c314a658f..d38878816 100644 --- a/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart +++ b/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart @@ -37,7 +37,8 @@ class BackButtonExitWrapper extends StatelessWidget { ElevatedButton( onPressed: () { userActionCompleter.complete(true); - SystemChannels.platform.invokeMethod('SystemNavigator.pop'); + SystemChannels.platform + .invokeMethod('SystemNavigator.pop'); }, child: Text(S.of(context).yes), ), From d5638daa7fdf9ebb79f3cb47e52c7fbffa31c933 Mon Sep 17 00:00:00 2001 From: thePeras Date: Fri, 25 Oct 2024 08:18:39 +0000 Subject: [PATCH 048/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index ee405355c..922a018f5 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.30+333 +1.10.0-beta.31+334 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 020d47c88..293b3ba9b 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.30+333 +version: 1.10.0-beta.31+334 environment: sdk: ">=3.4.0 <4.0.0" From c6b1c844b56af7c98b6aefb2aa6e97f86e9bcca9 Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Sat, 12 Oct 2024 20:00:52 +0100 Subject: [PATCH 049/100] Changed LibraryOccupation to sort floors by number when adding a new floor --- packages/uni_app/lib/model/entities/library_occupation.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index 9931652df..fbfad6b43 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -18,7 +18,10 @@ class LibraryOccupation { late List floors; void addFloor(FloorOccupation floor) { - floors.add(floor); + floors + ..add(floor) + ..sort((a, b) => a.number.compareTo(b.number)); + occupation += floor.occupation; capacity += floor.capacity; } From 360472ef31e8ee886a84f5e62e0be8b12e6e6850 Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Wed, 16 Oct 2024 16:03:55 +0100 Subject: [PATCH 050/100] Switch to SplayTreeSet for automatic floor ordering --- .../model/entities/library_occupation.g.dart | 16 +++++------ .../model/entities/library_occupation.dart | 28 +++++++++++++------ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart index fe8e7e4bb..370277fd6 100644 --- a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart +++ b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart @@ -8,24 +8,22 @@ part of '../../../model/entities/library_occupation.dart'; LibraryOccupation _$LibraryOccupationFromJson(Map json) => LibraryOccupation( - json['occupation'] as int, - json['capacity'] as int, - )..floors = (json['floors'] as List) - .map((e) => FloorOccupation.fromJson(e as Map)) - .toList(); + (json['occupation'] as num).toInt(), + (json['capacity'] as num).toInt(), + )..floors = LibraryOccupation._floorsFromJson(json['floors'] as List); Map _$LibraryOccupationToJson(LibraryOccupation instance) => { 'occupation': instance.occupation, 'capacity': instance.capacity, - 'floors': instance.floors, + 'floors': LibraryOccupation._floorsToJson(instance.floors), }; FloorOccupation _$FloorOccupationFromJson(Map json) => FloorOccupation( - json['number'] as int, - json['occupation'] as int, - json['capacity'] as int, + (json['number'] as num).toInt(), + (json['occupation'] as num).toInt(), + (json['capacity'] as num).toInt(), ); Map _$FloorOccupationToJson(FloorOccupation instance) => diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index fbfad6b43..5ad57118e 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -1,4 +1,5 @@ import 'dart:math'; +import 'dart:collection'; import 'package:json_annotation/json_annotation.dart'; @@ -8,20 +9,19 @@ part '../../generated/model/entities/library_occupation.g.dart'; @JsonSerializable() class LibraryOccupation { LibraryOccupation(this.occupation, this.capacity) { - floors = []; + floors = SplayTreeSet((a, b) => a.number.compareTo(b.number)); } factory LibraryOccupation.fromJson(Map json) => _$LibraryOccupationFromJson(json); late int occupation; late int capacity; - late List floors; + + @JsonKey(fromJson: _floorsFromJson, toJson: _floorsToJson) + late SplayTreeSet floors; void addFloor(FloorOccupation floor) { - floors - ..add(floor) - ..sort((a, b) => a.number.compareTo(b.number)); - + floors.add(floor); occupation += floor.occupation; capacity += floor.capacity; } @@ -37,10 +37,22 @@ class LibraryOccupation { if (floors.length < number || number < 0) { return FloorOccupation(0, 0, 0); } - return floors[number - 1]; + return floors.elementAt(number - 1); } Map toJson() => _$LibraryOccupationToJson(this); + + static SplayTreeSet _floorsFromJson(List json) { + var set = SplayTreeSet((a, b) => a.number.compareTo(b.number)); + json.forEach((element) { + set.add(FloorOccupation.fromJson(element as Map)); + }); + return set; + } + + static List> _floorsToJson(SplayTreeSet floors) { + return floors.map((floor) => floor.toJson()).toList(); + } } /// Occupation values of a single floor @@ -62,4 +74,4 @@ class FloorOccupation { } Map toJson() => _$FloorOccupationToJson(this); -} +} \ No newline at end of file From 7127f7db15e9a85418c226888859f018b97c7139 Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Tue, 22 Oct 2024 18:08:20 +0100 Subject: [PATCH 051/100] Revert "Switch to SplayTreeSet for automatic floor ordering" This reverts commit 4d8b270bff391e0bf632196e199e0ebd632e3906. --- .../model/entities/library_occupation.g.dart | 16 ++++++----- .../model/entities/library_occupation.dart | 28 ++++++------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart index 370277fd6..fe8e7e4bb 100644 --- a/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart +++ b/packages/uni_app/lib/generated/model/entities/library_occupation.g.dart @@ -8,22 +8,24 @@ part of '../../../model/entities/library_occupation.dart'; LibraryOccupation _$LibraryOccupationFromJson(Map json) => LibraryOccupation( - (json['occupation'] as num).toInt(), - (json['capacity'] as num).toInt(), - )..floors = LibraryOccupation._floorsFromJson(json['floors'] as List); + json['occupation'] as int, + json['capacity'] as int, + )..floors = (json['floors'] as List) + .map((e) => FloorOccupation.fromJson(e as Map)) + .toList(); Map _$LibraryOccupationToJson(LibraryOccupation instance) => { 'occupation': instance.occupation, 'capacity': instance.capacity, - 'floors': LibraryOccupation._floorsToJson(instance.floors), + 'floors': instance.floors, }; FloorOccupation _$FloorOccupationFromJson(Map json) => FloorOccupation( - (json['number'] as num).toInt(), - (json['occupation'] as num).toInt(), - (json['capacity'] as num).toInt(), + json['number'] as int, + json['occupation'] as int, + json['capacity'] as int, ); Map _$FloorOccupationToJson(FloorOccupation instance) => diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index 5ad57118e..fbfad6b43 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -1,5 +1,4 @@ import 'dart:math'; -import 'dart:collection'; import 'package:json_annotation/json_annotation.dart'; @@ -9,19 +8,20 @@ part '../../generated/model/entities/library_occupation.g.dart'; @JsonSerializable() class LibraryOccupation { LibraryOccupation(this.occupation, this.capacity) { - floors = SplayTreeSet((a, b) => a.number.compareTo(b.number)); + floors = []; } factory LibraryOccupation.fromJson(Map json) => _$LibraryOccupationFromJson(json); late int occupation; late int capacity; - - @JsonKey(fromJson: _floorsFromJson, toJson: _floorsToJson) - late SplayTreeSet floors; + late List floors; void addFloor(FloorOccupation floor) { - floors.add(floor); + floors + ..add(floor) + ..sort((a, b) => a.number.compareTo(b.number)); + occupation += floor.occupation; capacity += floor.capacity; } @@ -37,22 +37,10 @@ class LibraryOccupation { if (floors.length < number || number < 0) { return FloorOccupation(0, 0, 0); } - return floors.elementAt(number - 1); + return floors[number - 1]; } Map toJson() => _$LibraryOccupationToJson(this); - - static SplayTreeSet _floorsFromJson(List json) { - var set = SplayTreeSet((a, b) => a.number.compareTo(b.number)); - json.forEach((element) { - set.add(FloorOccupation.fromJson(element as Map)); - }); - return set; - } - - static List> _floorsToJson(SplayTreeSet floors) { - return floors.map((floor) => floor.toJson()).toList(); - } } /// Occupation values of a single floor @@ -74,4 +62,4 @@ class FloorOccupation { } Map toJson() => _$FloorOccupationToJson(this); -} \ No newline at end of file +} From 2a263f94481b729c3d04f53949ac0aa616004219 Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Tue, 22 Oct 2024 18:56:45 +0100 Subject: [PATCH 052/100] Moved floor sorting to occur after all floors are added in LibraryOccupation --- .../controller/fetchers/library_occupation_fetcher.dart | 3 ++- .../uni_app/lib/model/entities/library_occupation.dart | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart index f0616bd13..34798352c 100644 --- a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart +++ b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart @@ -38,7 +38,8 @@ class LibraryOccupationFetcher { libraryOccupation.addFloor(floorOccupation); }), ); - + + libraryOccupation.sortFloors(); return libraryOccupation; } diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index fbfad6b43..bf6eb0924 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -18,10 +18,7 @@ class LibraryOccupation { late List floors; void addFloor(FloorOccupation floor) { - floors - ..add(floor) - ..sort((a, b) => a.number.compareTo(b.number)); - + floors.add(floor); occupation += floor.occupation; capacity += floor.capacity; } @@ -40,6 +37,10 @@ class LibraryOccupation { return floors[number - 1]; } + void sortFloors(){ + floors.sort((a, b) => a.number.compareTo(b.number)); + } + Map toJson() => _$LibraryOccupationToJson(this); } From 25ea9ef98b1a2cc949e66641c856b2db987732f0 Mon Sep 17 00:00:00 2001 From: Adriano Machado Date: Tue, 22 Oct 2024 19:00:27 +0100 Subject: [PATCH 053/100] Applied Dart formatting --- .../lib/controller/fetchers/library_occupation_fetcher.dart | 2 +- packages/uni_app/lib/model/entities/library_occupation.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart index 34798352c..be22fb683 100644 --- a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart +++ b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart @@ -38,7 +38,7 @@ class LibraryOccupationFetcher { libraryOccupation.addFloor(floorOccupation); }), ); - + libraryOccupation.sortFloors(); return libraryOccupation; } diff --git a/packages/uni_app/lib/model/entities/library_occupation.dart b/packages/uni_app/lib/model/entities/library_occupation.dart index bf6eb0924..cdf692efd 100644 --- a/packages/uni_app/lib/model/entities/library_occupation.dart +++ b/packages/uni_app/lib/model/entities/library_occupation.dart @@ -37,7 +37,7 @@ class LibraryOccupation { return floors[number - 1]; } - void sortFloors(){ + void sortFloors() { floors.sort((a, b) => a.number.compareTo(b.number)); } From d76e43c8ff9661ece35889b2e40522d6b9560793 Mon Sep 17 00:00:00 2001 From: thePeras Date: Fri, 25 Oct 2024 08:18:39 +0000 Subject: [PATCH 054/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index ee405355c..922a018f5 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.30+333 +1.10.0-beta.31+334 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 020d47c88..293b3ba9b 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.30+333 +version: 1.10.0-beta.31+334 environment: sdk: ">=3.4.0 <4.0.0" From f92ae0991b160d23aeb06a7cca2a212a24587fb9 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sun, 27 Oct 2024 12:23:30 +0000 Subject: [PATCH 055/100] SystemNavigator.pop() async --- packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart b/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart index d38878816..da241f604 100644 --- a/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart +++ b/packages/uni_app/lib/view/home/widgets/exit_app_dialog.dart @@ -35,10 +35,9 @@ class BackButtonExitWrapper extends StatelessWidget { child: Text(S.of(context).no), ), ElevatedButton( - onPressed: () { + onPressed: () async { userActionCompleter.complete(true); - SystemChannels.platform - .invokeMethod('SystemNavigator.pop'); + await SystemNavigator.pop(); }, child: Text(S.of(context).yes), ), From 0a8755d28b122a75b487bc727410a138aee1a661 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Mon, 28 Oct 2024 00:45:14 +0000 Subject: [PATCH 056/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 922a018f5..f29c7bfbb 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.31+334 +1.10.0-beta.32+335 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 293b3ba9b..8e952b27d 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.31+334 +version: 1.10.0-beta.32+335 environment: sdk: ">=3.4.0 <4.0.0" From 871b0ad1c3ec9fa5de5978f1ab08db39bae7cf2a Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Thu, 31 Oct 2024 01:12:07 +0000 Subject: [PATCH 057/100] feat: added mapper function to LazyConsumer --- packages/uni_app/lib/view/lazy_consumer.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/uni_app/lib/view/lazy_consumer.dart b/packages/uni_app/lib/view/lazy_consumer.dart index 49e9f39b6..97a7a5283 100644 --- a/packages/uni_app/lib/view/lazy_consumer.dart +++ b/packages/uni_app/lib/view/lazy_consumer.dart @@ -28,6 +28,7 @@ class LazyConsumer, T2> required this.hasContent, required this.onNullContent, this.contentLoadingWidget, + this.mapper, super.key, }); @@ -35,6 +36,9 @@ class LazyConsumer, T2> final bool Function(T2) hasContent; final Widget onNullContent; final Widget? contentLoadingWidget; + final T2 Function(T2)? mapper; + + static T2 _defaultMapper(T2 value) => value; @override Widget build(BuildContext context) { @@ -89,8 +93,10 @@ class LazyConsumer, T2> } Widget requestDependantWidget(BuildContext context, T1 provider) { - final showContent = - provider.state != null && hasContent(provider.state as T2); + final mappedState = provider.state != null + ? (mapper ?? _defaultMapper)(provider.state as T2) + : null; + final showContent = provider.state != null && hasContent(mappedState as T2); if (provider.requestStatus == RequestStatus.busy && !showContent) { return loadingWidget(context); @@ -99,7 +105,7 @@ class LazyConsumer, T2> } return showContent - ? builder(context, provider.state as T2) + ? builder(context, mappedState) : Center( child: Padding( padding: const EdgeInsets.symmetric(vertical: 10), From 1c1c5e36915225baf7e2a233c7548ca9e0d43828 Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Thu, 31 Oct 2024 01:24:25 +0000 Subject: [PATCH 058/100] fix(schedule_card): filter past lectures in mapper --- packages/uni_app/lib/view/home/widgets/schedule_card.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/uni_app/lib/view/home/widgets/schedule_card.dart b/packages/uni_app/lib/view/home/widgets/schedule_card.dart index 411051471..2966ae641 100644 --- a/packages/uni_app/lib/view/home/widgets/schedule_card.dart +++ b/packages/uni_app/lib/view/home/widgets/schedule_card.dart @@ -49,6 +49,9 @@ class ScheduleCard extends GenericCard { ), ), contentLoadingWidget: const ScheduleCardShimmer().build(context), + mapper: (lectures) => lectures + .where((lecture) => lecture.endTime.compareTo(DateTime.now()) > 0) + .toList(), ); } From 35d63292a7d47e2699a1a016f01943a77f9ecc5e Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Thu, 31 Oct 2024 11:03:20 +0000 Subject: [PATCH 059/100] fix(schedule_card): Changed date compareTo to isAfter and removed duplicate code --- .../lib/view/home/widgets/schedule_card.dart | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/uni_app/lib/view/home/widgets/schedule_card.dart b/packages/uni_app/lib/view/home/widgets/schedule_card.dart index 2966ae641..bdfecde3c 100644 --- a/packages/uni_app/lib/view/home/widgets/schedule_card.dart +++ b/packages/uni_app/lib/view/home/widgets/schedule_card.dart @@ -10,6 +10,7 @@ import 'package:uni/model/utils/time/week.dart'; import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/date_rectangle.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; +import 'package:uni/view/exams/exams.dart'; import 'package:uni/view/home/widgets/schedule_card_shimmer.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/locale_notifier.dart'; @@ -50,7 +51,11 @@ class ScheduleCard extends GenericCard { ), contentLoadingWidget: const ScheduleCardShimmer().build(context), mapper: (lectures) => lectures - .where((lecture) => lecture.endTime.compareTo(DateTime.now()) > 0) + .where( + (lecture) => + lecture.endTime.isAfter(DateTime.now()) || + lecture.startTime.weekday != DateTime.now().weekday, + ) .toList(), ); } @@ -74,16 +79,8 @@ class ScheduleCard extends GenericCard { for (final dayLectures in lecturesByDay.sublist(0, min(2, lecturesByDay.length))) { final day = dayLectures.key; - final lectures = dayLectures.value - .where( - (element) => - // Hide finished lectures from today - element.startTime.weekday != DateTime.now().weekday || - element.endTime.isAfter(DateTime.now()), - ) - .toList(); - if (lectures.isEmpty) { + if (dayLectures.value.isEmpty) { continue; } @@ -94,11 +91,11 @@ class ScheduleCard extends GenericCard { ), ); - for (final lecture in lectures) { + for (final lecture in dayLectures.value) { rows.add(createRowFromLecture(context, lecture)); } - if (lectures.length >= 2) { + if (dayLectures.value.length >= 2) { break; } } From df13b7706a2540ac2e7815183178c8c6a45a99b3 Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Thu, 31 Oct 2024 11:42:10 +0000 Subject: [PATCH 060/100] fix(lazy_consumer): updated mapper type to handle dynamic values --- packages/uni_app/lib/view/home/widgets/schedule_card.dart | 3 +-- packages/uni_app/lib/view/lazy_consumer.dart | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/uni_app/lib/view/home/widgets/schedule_card.dart b/packages/uni_app/lib/view/home/widgets/schedule_card.dart index bdfecde3c..477ed4904 100644 --- a/packages/uni_app/lib/view/home/widgets/schedule_card.dart +++ b/packages/uni_app/lib/view/home/widgets/schedule_card.dart @@ -10,7 +10,6 @@ import 'package:uni/model/utils/time/week.dart'; import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/date_rectangle.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; -import 'package:uni/view/exams/exams.dart'; import 'package:uni/view/home/widgets/schedule_card_shimmer.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/locale_notifier.dart'; @@ -50,7 +49,7 @@ class ScheduleCard extends GenericCard { ), ), contentLoadingWidget: const ScheduleCardShimmer().build(context), - mapper: (lectures) => lectures + mapper: (lectures) => (lectures as List) .where( (lecture) => lecture.endTime.isAfter(DateTime.now()) || diff --git a/packages/uni_app/lib/view/lazy_consumer.dart b/packages/uni_app/lib/view/lazy_consumer.dart index 97a7a5283..11f797343 100644 --- a/packages/uni_app/lib/view/lazy_consumer.dart +++ b/packages/uni_app/lib/view/lazy_consumer.dart @@ -36,9 +36,9 @@ class LazyConsumer, T2> final bool Function(T2) hasContent; final Widget onNullContent; final Widget? contentLoadingWidget; - final T2 Function(T2)? mapper; + final T2 Function(dynamic)? mapper; - static T2 _defaultMapper(T2 value) => value; + static T2 _defaultMapper(dynamic value) => value as T2; @override Widget build(BuildContext context) { @@ -94,8 +94,9 @@ class LazyConsumer, T2> Widget requestDependantWidget(BuildContext context, T1 provider) { final mappedState = provider.state != null - ? (mapper ?? _defaultMapper)(provider.state as T2) + ? (mapper ?? _defaultMapper)(provider.state as dynamic) : null; + final showContent = provider.state != null && hasContent(mappedState as T2); if (provider.requestStatus == RequestStatus.busy && !showContent) { From 08f43e5ee1b1fd8de8d638b30ab6e9fff1874c2a Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Thu, 31 Oct 2024 11:45:25 +0000 Subject: [PATCH 061/100] fix(schedule_card): removed useless weekday check in lecture filtering --- packages/uni_app/lib/view/home/widgets/schedule_card.dart | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/uni_app/lib/view/home/widgets/schedule_card.dart b/packages/uni_app/lib/view/home/widgets/schedule_card.dart index 477ed4904..bf5ac7d9a 100644 --- a/packages/uni_app/lib/view/home/widgets/schedule_card.dart +++ b/packages/uni_app/lib/view/home/widgets/schedule_card.dart @@ -50,11 +50,7 @@ class ScheduleCard extends GenericCard { ), contentLoadingWidget: const ScheduleCardShimmer().build(context), mapper: (lectures) => (lectures as List) - .where( - (lecture) => - lecture.endTime.isAfter(DateTime.now()) || - lecture.startTime.weekday != DateTime.now().weekday, - ) + .where((lecture) => lecture.endTime.isAfter(DateTime.now())) .toList(), ); } From 044f8232be64cd6356db9746fbe40c91a0620812 Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Thu, 31 Oct 2024 13:03:11 +0000 Subject: [PATCH 062/100] fix(lazy_consumer): reverted mapper function type --- packages/uni_app/lib/view/home/widgets/schedule_card.dart | 2 +- packages/uni_app/lib/view/lazy_consumer.dart | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/uni_app/lib/view/home/widgets/schedule_card.dart b/packages/uni_app/lib/view/home/widgets/schedule_card.dart index bf5ac7d9a..32edc2752 100644 --- a/packages/uni_app/lib/view/home/widgets/schedule_card.dart +++ b/packages/uni_app/lib/view/home/widgets/schedule_card.dart @@ -49,7 +49,7 @@ class ScheduleCard extends GenericCard { ), ), contentLoadingWidget: const ScheduleCardShimmer().build(context), - mapper: (lectures) => (lectures as List) + mapper: (lectures) => lectures .where((lecture) => lecture.endTime.isAfter(DateTime.now())) .toList(), ); diff --git a/packages/uni_app/lib/view/lazy_consumer.dart b/packages/uni_app/lib/view/lazy_consumer.dart index 11f797343..795e249e2 100644 --- a/packages/uni_app/lib/view/lazy_consumer.dart +++ b/packages/uni_app/lib/view/lazy_consumer.dart @@ -36,9 +36,9 @@ class LazyConsumer, T2> final bool Function(T2) hasContent; final Widget onNullContent; final Widget? contentLoadingWidget; - final T2 Function(dynamic)? mapper; + final T2 Function(T2)? mapper; - static T2 _defaultMapper(dynamic value) => value as T2; + static T2 _defaultMapper(T2 value) => value; @override Widget build(BuildContext context) { @@ -94,7 +94,7 @@ class LazyConsumer, T2> Widget requestDependantWidget(BuildContext context, T1 provider) { final mappedState = provider.state != null - ? (mapper ?? _defaultMapper)(provider.state as dynamic) + ? (mapper ?? _defaultMapper)(provider.state as T2) : null; final showContent = provider.state != null && hasContent(mappedState as T2); From 7e98d316c413c4029d4c41f2349785bbe0140e30 Mon Sep 17 00:00:00 2001 From: HenriqueSFernandes Date: Thu, 31 Oct 2024 14:06:44 +0000 Subject: [PATCH 063/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index f29c7bfbb..94ed247cc 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.32+335 +1.10.0-beta.33+336 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 8e952b27d..74eccf404 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.32+335 +version: 1.10.0-beta.33+336 environment: sdk: ">=3.4.0 <4.0.0" From 63b0ff7526eb774f44655df3022c2344f653baf5 Mon Sep 17 00:00:00 2001 From: thePeras Date: Sat, 2 Nov 2024 15:13:47 +0000 Subject: [PATCH 064/100] Exam card rooms fade --- .../lib/{ => cards}/course_grade_card.dart | 10 +- packages/uni_ui/lib/cards/exam_card.dart | 124 +++++++++--------- .../uni_ui/lib/{ => cards}/service_card.dart | 2 +- 3 files changed, 69 insertions(+), 67 deletions(-) rename packages/uni_ui/lib/{ => cards}/course_grade_card.dart (79%) rename packages/uni_ui/lib/{ => cards}/service_card.dart (96%) diff --git a/packages/uni_ui/lib/course_grade_card.dart b/packages/uni_ui/lib/cards/course_grade_card.dart similarity index 79% rename from packages/uni_ui/lib/course_grade_card.dart rename to packages/uni_ui/lib/cards/course_grade_card.dart index e004c5ee6..845d61715 100644 --- a/packages/uni_ui/lib/course_grade_card.dart +++ b/packages/uni_ui/lib/cards/course_grade_card.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:uni_ui/generic_card.dart'; +import 'package:uni_ui/cards/generic_card.dart'; class CourseGradeCard extends StatelessWidget { const CourseGradeCard( @@ -32,12 +32,8 @@ class CourseGradeCard extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - "${ects} ECTS", - style: theme.textTheme.bodyLarge - ), - Text("${grade.toInt()}", - style: theme.textTheme.bodyLarge) + Text("${ects} ECTS", style: theme.textTheme.bodyLarge), + Text("${grade.toInt()}", style: theme.textTheme.bodyLarge) ], ) ], diff --git a/packages/uni_ui/lib/cards/exam_card.dart b/packages/uni_ui/lib/cards/exam_card.dart index eaa3d210f..a6f291c1a 100644 --- a/packages/uni_ui/lib/cards/exam_card.dart +++ b/packages/uni_ui/lib/cards/exam_card.dart @@ -32,71 +32,77 @@ class ExamCard extends StatelessWidget { child: GenericCard( key: key, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - acronym, - overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.headlineMedium!, - ), - const SizedBox(width: 8), - Badge( - label: Text(type), - backgroundColor: BadgeColors.er, - textColor: Theme.of(context).colorScheme.surface, - ), - ], - ), - Text( - name, - overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.titleLarge!, - ), - const SizedBox(height: 5), - Row( - children: [ - PhosphorIcon( - PhosphorIcons.clock(PhosphorIconsStyle.duotone), - color: Theme.of(context).iconTheme.color, - size: 20, - ), - const SizedBox(width: 4), - Text( - startTime ?? "--:--", - style: Theme.of(context).textTheme.bodyMedium!, - ), - const SizedBox(width: 8), - if (!rooms.isEmpty) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + acronym, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.headlineMedium!, + ), + const SizedBox(width: 8), + Badge( + label: Text(type), + backgroundColor: BadgeColors.er, + textColor: Theme.of(context).colorScheme.surface, + ), + ], + ), + Text( + name, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.titleLarge!, + ), + const SizedBox(height: 5), + Row( + children: [ PhosphorIcon( - PhosphorIcons.mapPin(PhosphorIconsStyle.duotone), + PhosphorIcons.clock(PhosphorIconsStyle.duotone), color: Theme.of(context).iconTheme.color, size: 20, ), - const SizedBox(width: 4), - SizedBox( - height: 20, - child: ListView.separated( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: rooms.length, - separatorBuilder: (context, int index) { - return const SizedBox(width: 4); - }, - itemBuilder: (context, int index) { - return IntrinsicWidth( - child: Text(rooms[index]), - ); - }, + const SizedBox(width: 4), + Text( + startTime ?? "--:--", + style: Theme.of(context).textTheme.bodyMedium!, + ), + const SizedBox(width: 8), + if (!rooms.isEmpty) + PhosphorIcon( + PhosphorIcons.mapPin(PhosphorIconsStyle.duotone), + color: Theme.of(context).iconTheme.color, + size: 20, + ), + const SizedBox(width: 4), + Expanded( + child: ShaderMask( + shaderCallback: (Rect bounds) { + return const LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [Colors.black, Colors.transparent], + stops: [0.8, 1.0], + ).createShader(bounds); + }, + blendMode: BlendMode.dstIn, + child: SingleChildScrollView( + physics: const NeverScrollableScrollPhysics(), + scrollDirection: Axis.horizontal, + child: Text( + rooms.join(" "), + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + ), ), - ), - ], - ) - ], + ], + ) + ], + ), ), if (showIcon) IconButton( diff --git a/packages/uni_ui/lib/service_card.dart b/packages/uni_ui/lib/cards/service_card.dart similarity index 96% rename from packages/uni_ui/lib/service_card.dart rename to packages/uni_ui/lib/cards/service_card.dart index 2628c7f1e..c002a7a86 100644 --- a/packages/uni_ui/lib/service_card.dart +++ b/packages/uni_ui/lib/cards/service_card.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:phosphor_flutter/phosphor_flutter.dart'; -import 'package:uni_ui/generic_card.dart'; +import 'package:uni_ui/cards/generic_card.dart'; class ServiceCard extends StatelessWidget { const ServiceCard({ From 78eda123cfa972dc3b6cdbf93ddd774c385cd442 Mon Sep 17 00:00:00 2001 From: thePeras Date: Sat, 2 Nov 2024 15:54:50 +0000 Subject: [PATCH 065/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 94ed247cc..1b9195b98 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.33+336 +1.10.0-beta.34+337 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 74eccf404..24869c662 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.33+336 +version: 1.10.0-beta.34+337 environment: sdk: ">=3.4.0 <4.0.0" From 249fc86e3e600f6a516bc3cf85a253051d0fe5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sim=C3=A3o=20Barbosa?= <117586175+simaopsbarbosa@users.noreply.github.com> Date: Sat, 2 Nov 2024 20:53:42 +0000 Subject: [PATCH 066/100] fixed path to MVC.png --- packages/uni_app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uni_app/README.md b/packages/uni_app/README.md index 6d14d29ff..5a24810d8 100644 --- a/packages/uni_app/README.md +++ b/packages/uni_app/README.md @@ -66,7 +66,7 @@ To use the translation import `'package:uni/generated/l10n.dart'` and use `S.of( For this project, we separate the code into *model, *view* and *controller*. By making sure view-only components are clear from the rest of the code, we can assure safe reuse of widgets as well as separated testing and development. -![MVC Scheme](../readme-src/MVC.png "MVC Scheme") +![MVC Scheme](../../readme-src/MVC.png "MVC Scheme") ### Model The *model* represents the entities that are used in the app, including the session, the classes, the exams. They should be generated from the controller's methods and passed to the view. The model should not contain logic, but only the data that is needed to display the information. From d8a057ed2e453391ba3b18feeb37878af66c4e8b Mon Sep 17 00:00:00 2001 From: simaopsbarbosa Date: Sun, 3 Nov 2024 17:09:34 +0000 Subject: [PATCH 067/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 1b9195b98..8d05f6a01 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.34+337 +1.10.0-beta.35+338 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 24869c662..7c5d3d057 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.34+337 +version: 1.10.0-beta.35+338 environment: sdk: ">=3.4.0 <4.0.0" From 4460dfcdafe0aba3ff5d58d0d71214f349cf6e86 Mon Sep 17 00:00:00 2001 From: Pinho13 Date: Tue, 5 Nov 2024 17:24:40 +0000 Subject: [PATCH 068/100] fix: Added Controllers Dispose methods --- .../uni_app/lib/view/restaurant/restaurant_page_view.dart | 7 +++++++ packages/uni_app/pubspec.lock | 8 ++++++++ packages/uni_ui/lib/timeline/timeline.dart | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart b/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart index f78a06d07..d5933af9b 100644 --- a/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart +++ b/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart @@ -35,6 +35,13 @@ class _RestaurantPageViewState extends GeneralPageViewState scrollViewController = ScrollController(); } + @override + void dispose() { + tabController.dispose(); + scrollViewController.dispose(); + super.dispose(); + } + @override String? getTitle() => S.of(context).nav_title(NavigationItem.navRestaurants.route); diff --git a/packages/uni_app/pubspec.lock b/packages/uni_app/pubspec.lock index 04778b73c..e9483f5c4 100644 --- a/packages/uni_app/pubspec.lock +++ b/packages/uni_app/pubspec.lock @@ -1147,6 +1147,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.28.0" + scrollable_positioned_list: + dependency: transitive + description: + name: scrollable_positioned_list + sha256: "1b54d5f1329a1e263269abc9e2543d90806131aa14fe7c6062a8054d57249287" + url: "https://pub.dev" + source: hosted + version: "0.3.8" sentry: dependency: transitive description: diff --git a/packages/uni_ui/lib/timeline/timeline.dart b/packages/uni_ui/lib/timeline/timeline.dart index e4c2e2a20..2c4590927 100644 --- a/packages/uni_ui/lib/timeline/timeline.dart +++ b/packages/uni_ui/lib/timeline/timeline.dart @@ -50,6 +50,12 @@ class _TimelineState extends State { }); } + @override + void dispose() { + _tabScrollController.dispose(); + super.dispose(); + } + void _onTabTapped(int index) { _itemScrollController.scrollTo( index: index, @@ -123,7 +129,7 @@ class _TimelineState extends State { child: ScrollablePositionedList.builder( itemCount: widget.content.length, itemScrollController: _itemScrollController, - itemPositionsListener: _itemPositionsListener, + itemPositionsListener: _itemPositionsListener, itemBuilder: (context, index) { return widget.content[index]; }, From 9b5ada747f9d6249646cea0fa5e8dc0b7453e29b Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Wed, 6 Nov 2024 21:59:27 +0000 Subject: [PATCH 069/100] added internetError exception and failure reason --- packages/uni_app/lib/session/exception.dart | 1 + .../sigarra/endpoints/html/authentication/login/response.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/uni_app/lib/session/exception.dart b/packages/uni_app/lib/session/exception.dart index 712ceae75..e1fb9232f 100644 --- a/packages/uni_app/lib/session/exception.dart +++ b/packages/uni_app/lib/session/exception.dart @@ -1,4 +1,5 @@ enum AuthenticationExceptionType { + internetError, wrongCredentials, expiredCredentials, other, diff --git a/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart b/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart index 4399da48f..dc8a26db1 100644 --- a/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart +++ b/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart @@ -8,6 +8,7 @@ class LoginResponse extends SigarraResponse { enum LoginFailureReason { serverError, + internetError, wrongCredentials, expiredCredentials, blockedAccount, From 65782a45291e198b7ce62440f36ccbf8a70d4e02 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Wed, 6 Nov 2024 22:08:46 +0000 Subject: [PATCH 070/100] completed the credential request failure handling --- .../lib/session/flows/credentials/request.dart | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/uni_app/lib/session/flows/credentials/request.dart b/packages/uni_app/lib/session/flows/credentials/request.dart index 727935b29..de2235395 100644 --- a/packages/uni_app/lib/session/flows/credentials/request.dart +++ b/packages/uni_app/lib/session/flows/credentials/request.dart @@ -1,4 +1,6 @@ +import 'dart:async'; import 'package:http/http.dart' as http; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni/controller/fetchers/faculties_fetcher.dart'; import 'package:uni/session/exception.dart'; import 'package:uni/session/flows/base/request.dart'; @@ -35,11 +37,21 @@ class CredentialsSessionRequest extends SessionRequest { 'Failed to authenticate user', AuthenticationExceptionType.expiredCredentials, ); - } else { + } else if (failureReason == LoginFailureReason.internetError) { + throw const AuthenticationException( + 'Failed to authenticate user', + AuthenticationExceptionType.internetError, + ); + } else if (failureReason == LoginFailureReason.wrongCredentials) { throw const AuthenticationException( 'Failed to authenticate user', AuthenticationExceptionType.wrongCredentials, ); + } else { + unawaited(Sentry.captureException(failureReason)); + throw const AuthenticationException( + 'Failed to authenticate user', + ); } } From cbc58403ab22c1034e863928283a886a7f630f1d Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Wed, 6 Nov 2024 22:16:41 +0000 Subject: [PATCH 071/100] removed previous login failure exceptions --- .../lib/model/entities/login_exceptions.dart | 11 ------- packages/uni_app/lib/view/login/login.dart | 30 +------------------ 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 packages/uni_app/lib/model/entities/login_exceptions.dart diff --git a/packages/uni_app/lib/model/entities/login_exceptions.dart b/packages/uni_app/lib/model/entities/login_exceptions.dart deleted file mode 100644 index d701801d4..000000000 --- a/packages/uni_app/lib/model/entities/login_exceptions.dart +++ /dev/null @@ -1,11 +0,0 @@ -class ExpiredCredentialsException implements Exception { - ExpiredCredentialsException(); -} - -class InternetStatusException implements Exception { - InternetStatusException(); -} - -class WrongCredentialsException implements Exception { - WrongCredentialsException(); -} diff --git a/packages/uni_app/lib/view/login/login.dart b/packages/uni_app/lib/view/login/login.dart index cab5cfcb2..e71ed068c 100644 --- a/packages/uni_app/lib/view/login/login.dart +++ b/packages/uni_app/lib/view/login/login.dart @@ -9,7 +9,6 @@ import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni/app_links/uni_app_links.dart'; import 'package:uni/controller/networking/url_launcher.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/model/entities/login_exceptions.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; import 'package:uni/model/providers/state_providers.dart'; import 'package:uni/session/flows/credentials/initiator.dart'; @@ -99,37 +98,10 @@ class LoginPageViewState extends State _loggingIn = false; }); } - } catch (err, st) { + } catch (err) { setState(() { _loggingIn = false; }); - if (err is ExpiredCredentialsException) { - _updatePasswordDialog(); - } else if (err is InternetStatusException) { - if (mounted) { - unawaited( - ToastMessage.warning( - context, - S.of(context).internet_status_exception, - ), - ); - } - } else if (err is WrongCredentialsException) { - if (mounted) { - unawaited( - ToastMessage.error( - context, - S.of(context).wrong_credentials_exception, - ), - ); - } - } else { - Logger().e(err, stackTrace: st); - unawaited(Sentry.captureException(err, stackTrace: st)); - if (mounted) { - unawaited(ToastMessage.error(context, S.of(context).failed_login)); - } - } } } } From df48c3cc9de427fd2ed6a41dd111a8cec144b312 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Wed, 6 Nov 2024 22:36:16 +0000 Subject: [PATCH 072/100] removed update password dialog --- packages/uni_app/lib/view/login/login.dart | 43 ---------------------- 1 file changed, 43 deletions(-) diff --git a/packages/uni_app/lib/view/login/login.dart b/packages/uni_app/lib/view/login/login.dart index e71ed068c..370fa38eb 100644 --- a/packages/uni_app/lib/view/login/login.dart +++ b/packages/uni_app/lib/view/login/login.dart @@ -7,7 +7,6 @@ import 'package:logger/logger.dart'; import 'package:provider/provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni/app_links/uni_app_links.dart'; -import 'package:uni/controller/networking/url_launcher.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; import 'package:uni/model/providers/state_providers.dart'; @@ -336,46 +335,4 @@ class LoginPageViewState extends State }, ); } - - void _updatePasswordDialog() { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: Text(S.of(context).expired_password), - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - S.of(context).pass_change_request, - textAlign: TextAlign.start, - style: Theme.of(context).textTheme.titleSmall, - ), - const SizedBox(height: 20), - Align( - alignment: Alignment.centerLeft, - child: Text( - S.of(context).change_prompt, - textAlign: TextAlign.start, - ), - ), - ], - ), - actions: [ - TextButton( - child: Text(S.of(context).cancel), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ElevatedButton( - child: Text(S.of(context).change), - onPressed: () => - launchUrlWithToast(context, 'https://self-id.up.pt/password'), - ), - ], - ); - }, - ); - } } From bc5ba1ca676c60f5082f759ce97ca84acfa7df5f Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sat, 9 Nov 2024 11:54:10 +0000 Subject: [PATCH 073/100] handled login exceptions with AuthenticationException --- .../session/flows/credentials/request.dart | 2 - packages/uni_app/lib/view/login/login.dart | 88 ++++++++++++++++++- 2 files changed, 87 insertions(+), 3 deletions(-) diff --git a/packages/uni_app/lib/session/flows/credentials/request.dart b/packages/uni_app/lib/session/flows/credentials/request.dart index de2235395..cc658bd95 100644 --- a/packages/uni_app/lib/session/flows/credentials/request.dart +++ b/packages/uni_app/lib/session/flows/credentials/request.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'package:http/http.dart' as http; -import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni/controller/fetchers/faculties_fetcher.dart'; import 'package:uni/session/exception.dart'; import 'package:uni/session/flows/base/request.dart'; @@ -48,7 +47,6 @@ class CredentialsSessionRequest extends SessionRequest { AuthenticationExceptionType.wrongCredentials, ); } else { - unawaited(Sentry.captureException(failureReason)); throw const AuthenticationException( 'Failed to authenticate user', ); diff --git a/packages/uni_app/lib/view/login/login.dart b/packages/uni_app/lib/view/login/login.dart index 370fa38eb..9c1cbb45a 100644 --- a/packages/uni_app/lib/view/login/login.dart +++ b/packages/uni_app/lib/view/login/login.dart @@ -7,9 +7,11 @@ import 'package:logger/logger.dart'; import 'package:provider/provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni/app_links/uni_app_links.dart'; +import 'package:uni/controller/networking/url_launcher.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; import 'package:uni/model/providers/state_providers.dart'; +import 'package:uni/session/exception.dart'; import 'package:uni/session/flows/credentials/initiator.dart'; import 'package:uni/session/flows/federated/initiator.dart'; import 'package:uni/utils/constants.dart'; @@ -97,10 +99,52 @@ class LoginPageViewState extends State _loggingIn = false; }); } - } catch (err) { + } on AuthenticationException catch (err, st) { setState(() { _loggingIn = false; }); + + switch (err.type) { + case AuthenticationExceptionType.expiredCredentials: + _updatePasswordDialog(); + case AuthenticationExceptionType.internetError: + if (mounted) { + unawaited( + ToastMessage.warning( + context, + S.of(context).internet_status_exception, + ), + ); + } + case AuthenticationExceptionType.wrongCredentials: + if (mounted) { + unawaited( + ToastMessage.error( + context, + S.of(context).wrong_credentials_exception, + ), + ); + } + default: + Logger().e(err, stackTrace: st); + unawaited(Sentry.captureException(err, stackTrace: st)); + if (mounted) { + unawaited( + ToastMessage.error(context, S.of(context).failed_login), + ); + } + } + } + // Handles other unexpected exceptions + catch (err, st) { + setState(() { + _loggingIn = false; + }); + Logger().e(err, stackTrace: st); + unawaited(Sentry.captureException(err, stackTrace: st)); + if (mounted) { + unawaited(ToastMessage.error(context, S.of(context).failed_login)); + } } } } @@ -335,4 +379,46 @@ class LoginPageViewState extends State }, ); } + + void _updatePasswordDialog() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text(S.of(context).expired_password), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + S.of(context).pass_change_request, + textAlign: TextAlign.start, + style: Theme.of(context).textTheme.titleSmall, + ), + const SizedBox(height: 20), + Align( + alignment: Alignment.centerLeft, + child: Text( + S.of(context).change_prompt, + textAlign: TextAlign.start, + ), + ), + ], + ), + actions: [ + TextButton( + child: Text(S.of(context).cancel), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ElevatedButton( + child: Text(S.of(context).change), + onPressed: () => + launchUrlWithToast(context, 'https://self-id.up.pt/password'), + ), + ], + ); + }, + ); + } } From e30a31c172775ee4f2020f04ac4d876c2dcdf8ca Mon Sep 17 00:00:00 2001 From: thePeras Date: Mon, 11 Nov 2024 15:21:14 +0000 Subject: [PATCH 074/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 8d05f6a01..464eac0ff 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.35+338 +1.10.0-beta.36+339 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 7c5d3d057..a9d41f398 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.35+338 +version: 1.10.0-beta.36+339 environment: sdk: ">=3.4.0 <4.0.0" From df701d8800217c9d48ecbbfb70e432b5ed9ce26c Mon Sep 17 00:00:00 2001 From: Pinho13 Date: Tue, 12 Nov 2024 11:36:38 +0000 Subject: [PATCH 075/100] fix: Double super.initState and Disposed Timer --- .../lib/view/common_widgets/last_update_timestamp.dart | 10 ++++++++-- .../lib/view/restaurant/restaurant_page_view.dart | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/uni_app/lib/view/common_widgets/last_update_timestamp.dart b/packages/uni_app/lib/view/common_widgets/last_update_timestamp.dart index 403fb1e19..56e9b8789 100644 --- a/packages/uni_app/lib/view/common_widgets/last_update_timestamp.dart +++ b/packages/uni_app/lib/view/common_widgets/last_update_timestamp.dart @@ -18,11 +18,11 @@ class LastUpdateTimeStamp> class _LastUpdateTimeStampState> extends State { DateTime currentTime = DateTime.now(); - + Timer? timer; @override void initState() { super.initState(); - Timer.periodic( + timer = Timer.periodic( const Duration(seconds: 60), (timer) { if (mounted) { @@ -34,6 +34,12 @@ class _LastUpdateTimeStampState> ); } + @override + void dispose() { + timer?.cancel(); + super.dispose(); + } + @override Widget build(BuildContext context) { return Consumer( diff --git a/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart b/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart index d5933af9b..edd58ac12 100644 --- a/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart +++ b/packages/uni_app/lib/view/restaurant/restaurant_page_view.dart @@ -29,7 +29,6 @@ class _RestaurantPageViewState extends GeneralPageViewState void initState() { super.initState(); final weekDay = DateTime.now().weekday; - super.initState(); tabController = TabController(vsync: this, length: DayOfWeek.values.length); tabController.animateTo(tabController.index + (weekDay - 1)); scrollViewController = ScrollController(); From 8005aa5d3ad35ca01772192ef151fe8085e8aa29 Mon Sep 17 00:00:00 2001 From: jcovaa Date: Tue, 19 Nov 2024 17:19:00 +0000 Subject: [PATCH 076/100] Changed tuples to records - unfinished --- .../background_callback.dart | 9 +++--- .../background_workers/notifications.dart | 5 ++- .../notifications/tuition_notification.dart | 17 +++++----- .../fetchers/library_occupation_fetcher.dart | 19 ++++++----- .../database/app_user_database.dart | 2 +- .../parsers/parser_restaurants.dart | 9 +++--- .../lib/model/converters/tuple_converter.dart | 11 +++---- .../lib/model/entities/bug_report.dart | 3 +- .../uni_app/lib/model/entities/profile.dart | 13 ++++---- .../lazy/course_units_info_provider.dart | 32 +++++++++++-------- .../providers/startup/profile_provider.dart | 11 +++---- .../lib/view/bug_report/widgets/form.dart | 17 +++++----- packages/uni_app/pubspec.yaml | 1 - 13 files changed, 72 insertions(+), 77 deletions(-) diff --git a/packages/uni_app/lib/controller/background_workers/background_callback.dart b/packages/uni_app/lib/controller/background_workers/background_callback.dart index 1283b05fc..08c17414d 100644 --- a/packages/uni_app/lib/controller/background_workers/background_callback.dart +++ b/packages/uni_app/lib/controller/background_workers/background_callback.dart @@ -1,5 +1,4 @@ import 'package:logger/logger.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/controller/background_workers/notifications.dart'; import 'package:workmanager/workmanager.dart'; @@ -8,7 +7,7 @@ import 'package:workmanager/workmanager.dart'; /// (they must not take any arguments, not checked) const taskMap = { 'pt.up.fe.ni.uni.notificationworker': - Tuple2(NotificationManager.updateAndTriggerNotifications, true), + (NotificationManager.updateAndTriggerNotifications, true), }; @pragma('vm:entry-point') @@ -25,16 +24,16 @@ Future workerStartCallback() async { // by the iOS scheduler. if (taskName == Workmanager.iOSBackgroundTask) { taskMap.forEach((key, value) async { - if (value.item2) { + if (value.$2) { Logger().d('''[$key]: Start executing job...'''); - await value.item1(); + await value.$1(); } }); return true; } // try to keep the usage of this function BELOW +-30 seconds // to not be punished by the scheduler in future runs. - await taskMap[taskName]!.item1(); + await taskMap[taskName]!.$1(); } catch (err, st) { Logger().e( 'Error while running $taskName job:', diff --git a/packages/uni_app/lib/controller/background_workers/notifications.dart b/packages/uni_app/lib/controller/background_workers/notifications.dart index 7d1a7a218..b53cb29fa 100644 --- a/packages/uni_app/lib/controller/background_workers/notifications.dart +++ b/packages/uni_app/lib/controller/background_workers/notifications.dart @@ -6,7 +6,6 @@ import 'package:flutter/services.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:logger/logger.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/controller/background_workers/notifications/tuition_notification.dart'; import 'package:uni/controller/local_storage/notification_timeout_storage.dart'; import 'package:uni/controller/local_storage/preferences_controller.dart'; @@ -28,12 +27,12 @@ abstract class Notification { String uniqueID; Duration timeout; - Future> buildNotificationContent(Session session); + Future<(String, String)> buildNotificationContent(Session session); Future shouldDisplay(Session session); void displayNotification( - Tuple2 content, + (String, String) content, FlutterLocalNotificationsPlugin localNotificationsPlugin, ); diff --git a/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart b/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart index 076fe5dff..5ab9ccd1e 100644 --- a/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart +++ b/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart @@ -1,5 +1,4 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/controller/background_workers/notifications.dart'; import 'package:uni/controller/fetchers/fees_fetcher.dart'; import 'package:uni/controller/local_storage/preferences_controller.dart'; @@ -13,7 +12,7 @@ class TuitionNotification extends Notification { late DateTime _dueDate; @override - Future> buildNotificationContent( + Future<(String, String)> buildNotificationContent( Session session, ) async { // We must add one day because the time limit is actually at 23:59 and @@ -21,12 +20,12 @@ class TuitionNotification extends Notification { if (_dueDate.add(const Duration(days: 1)).isBefore(DateTime.now())) { final duration = DateTime.now().difference(_dueDate); if (duration.inDays == 0) { - return const Tuple2( + return const ( '⚠️ Ainda não pagaste as propinas ⚠️', 'O prazo para pagar as propinas acabou ontem', ); } - return Tuple2( + return ( '⚠️ Ainda não pagaste as propinas ⚠️', duration.toFormattedString( 'Já passou {} desde a data limite', @@ -36,12 +35,12 @@ class TuitionNotification extends Notification { } final duration = _dueDate.difference(DateTime.now()); if (duration.inDays == 0) { - return const Tuple2( + return const ( 'O prazo limite para as propinas está a acabar', 'Hoje acaba o prazo para pagamento das propinas!', ); } - return Tuple2( + return ( 'O prazo limite para as propinas está a acabar', duration.toFormattedString( 'Falta {} para a data limite', @@ -72,7 +71,7 @@ class TuitionNotification extends Notification { @override void displayNotification( - Tuple2 content, + (String, String) content, FlutterLocalNotificationsPlugin localNotificationsPlugin, ) { const androidNotificationDetails = AndroidNotificationDetails( @@ -95,8 +94,8 @@ class TuitionNotification extends Notification { localNotificationsPlugin.show( 2, - content.item1, - content.item2, + content.$1, + content.$2, notificationDetails, ); } diff --git a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart index be22fb683..088390844 100644 --- a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart +++ b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart @@ -3,20 +3,19 @@ import 'dart:convert'; import 'package:collection/collection.dart'; import 'package:http/http.dart' as http; import 'package:http/http.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/model/entities/library_occupation.dart'; /// Fetch the library occupation from Google Sheets class LibraryOccupationFetcher { String baseUrl = 'https://webapi.affluences.com/api/fillRate?'; - static const List> floorMaxSeats = [ - Tuple2('BruV6IlujdwAe1', 72), - Tuple2('cEhyzJZvC5nHSr', 114), - Tuple2('iceVfgwZWaZRhV', 114), - Tuple2('1yLPz9X0CNsg27', 114), - Tuple2('keu1j5zERlQn90', 40), - Tuple2('bY7K1v43HiAq55', 90), + static const List<(String, int)> floorMaxSeats = [ + ('BruV6IlujdwAe1', 72), + ('cEhyzJZvC5nHSr', 114), + ('iceVfgwZWaZRhV', 114), + ('1yLPz9X0CNsg27', 114), + ('keu1j5zERlQn90', 40), + ('bY7K1v43HiAq55', 90), ]; Future getLibraryOccupation() async { @@ -26,14 +25,14 @@ class LibraryOccupationFetcher { floorMaxSeats.mapIndexed((i, entry) async { final url = Uri.parse(baseUrl).replace( queryParameters: { - 'token': entry.item1, + 'token': entry.$1, }, ); final response = await http.get(url); final floorOccupation = - processFloorOccupation(response, entry.item2, i); + processFloorOccupation(response, entry.$2, i); libraryOccupation.addFloor(floorOccupation); }), diff --git a/packages/uni_app/lib/controller/local_storage/database/app_user_database.dart b/packages/uni_app/lib/controller/local_storage/database/app_user_database.dart index 51be2348b..0c25b204d 100644 --- a/packages/uni_app/lib/controller/local_storage/database/app_user_database.dart +++ b/packages/uni_app/lib/controller/local_storage/database/app_user_database.dart @@ -23,7 +23,7 @@ class AppUserDataDatabase extends AppDatabase { for (final keymap in data.keymapValues()) { await insertInDatabase( 'userdata', - {'name': keymap.item1, 'value': keymap.item2}, + {'name': keymap.$1, 'value': keymap.$2}, ); } } diff --git a/packages/uni_app/lib/controller/parsers/parser_restaurants.dart b/packages/uni_app/lib/controller/parsers/parser_restaurants.dart index a4c543f70..11d6be6d4 100644 --- a/packages/uni_app/lib/controller/parsers/parser_restaurants.dart +++ b/packages/uni_app/lib/controller/parsers/parser_restaurants.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import 'package:html/parser.dart'; import 'package:http/http.dart'; import 'package:intl/intl.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/model/entities/meal.dart'; import 'package:uni/model/entities/restaurant.dart'; import 'package:uni/model/utils/day_of_week.dart'; @@ -18,7 +17,7 @@ List getRestaurantsFromHtml(Response response) { final restaurantsTuple = restaurantsHtml.map((restaurantHtml) { final name = restaurantHtml.text; final ref = restaurantHtml.attributes['href']?.replaceAll('#', ''); - return Tuple2(ref ?? '', name); + return (ref ?? '', name); }).toList(); // Get restaurant meals and create the Restaurant class @@ -26,7 +25,7 @@ List getRestaurantsFromHtml(Response response) { final meals = []; final referenceA = - document.querySelector('a[name="${restaurantTuple.item1}"]'); + document.querySelector('a[name="${restaurantTuple.$1}"]'); var next = referenceA?.nextElementSibling; final format = DateFormat('d-M-y'); @@ -70,8 +69,8 @@ List getRestaurantsFromHtml(Response response) { } return Restaurant( null, - restaurantTuple.item2, - restaurantTuple.item1, + restaurantTuple.$2, + restaurantTuple.$1, meals: meals, ); }).toList(); diff --git a/packages/uni_app/lib/model/converters/tuple_converter.dart b/packages/uni_app/lib/model/converters/tuple_converter.dart index 49cb64ded..2c1b6ca69 100644 --- a/packages/uni_app/lib/model/converters/tuple_converter.dart +++ b/packages/uni_app/lib/model/converters/tuple_converter.dart @@ -1,22 +1,21 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:tuple/tuple.dart'; -class TupleConverter extends JsonConverter?, String?> { +class TupleConverter extends JsonConverter<(String, String)?, String?> { const TupleConverter(); @override - Tuple2? fromJson(String? json) { + (String, String)? fromJson(String? json) { if (json == null) { return null; } - return Tuple2('', json); + return ('', json); } @override - String? toJson(Tuple2? object) { + String? toJson((String, String)? object) { if (object == null) { return null; } - return object.item2; + return object.$2; } } diff --git a/packages/uni_app/lib/model/entities/bug_report.dart b/packages/uni_app/lib/model/entities/bug_report.dart index 8667e4945..e2f5276a8 100644 --- a/packages/uni_app/lib/model/entities/bug_report.dart +++ b/packages/uni_app/lib/model/entities/bug_report.dart @@ -1,6 +1,5 @@ // Stores information about Bug Report import 'package:json_annotation/json_annotation.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/model/converters/tuple_converter.dart'; part '../../generated/model/entities/bug_report.g.dart'; @@ -16,7 +15,7 @@ class BugReport { final String title; final String text; final String email; - final Tuple2? bugLabel; + final (String, String)? bugLabel; final List faculties; Map toJson() => _$BugReportToJson(this); diff --git a/packages/uni_app/lib/model/entities/profile.dart b/packages/uni_app/lib/model/entities/profile.dart index 125bf6fc8..29f487d11 100644 --- a/packages/uni_app/lib/model/entities/profile.dart +++ b/packages/uni_app/lib/model/entities/profile.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:http/http.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/model/entities/course.dart'; import 'package:uni/model/entities/course_units/course_unit.dart'; @@ -43,13 +42,13 @@ class Profile { /// Returns a list with two tuples: the first tuple contains the user's name /// and the other one contains the user's email. - List> keymapValues() { + List<(String, String)> keymapValues() { return [ - Tuple2('name', name), - Tuple2('email', email), - Tuple2('printBalance', printBalance), - Tuple2('feesBalance', feesBalance), - Tuple2( + ('name', name), + ('email', email), + ('printBalance', printBalance), + ('feesBalance', feesBalance), + ( 'feesLimit', feesLimit != null ? feesLimit!.toIso8601String() : '', ), diff --git a/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart b/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart index 37665631a..ede2fee25 100644 --- a/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart +++ b/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart @@ -1,6 +1,5 @@ import 'dart:collection'; -import 'package:tuple/tuple.dart'; import 'package:uni/controller/fetchers/course_units_fetcher/course_units_info_fetcher.dart'; import 'package:uni/model/entities/course_units/course_unit.dart'; import 'package:uni/model/entities/course_units/course_unit_class.dart'; @@ -15,24 +14,24 @@ typedef ClassesMap = Map>; typedef FilesMap = Map>; class CourseUnitsInfoProvider - extends StateProviderNotifier> { + extends StateProviderNotifier<(SheetsMap, ClassesMap, FilesMap)> { CourseUnitsInfoProvider() : super( cacheDuration: null, // Const constructor is not allowed here because of the // need for mutable maps // ignore: prefer_const_constructors - initialState: Tuple3({}, {}, {}), + initialState: ({}, {}, {}), ); UnmodifiableMapView get courseUnitsSheets => - UnmodifiableMapView(state!.item1); + UnmodifiableMapView(state!.$1); UnmodifiableMapView> - get courseUnitsClasses => UnmodifiableMapView(state!.item2); + get courseUnitsClasses => UnmodifiableMapView(state!.$2); UnmodifiableMapView> - get courseUnitsFiles => UnmodifiableMapView(state!.item3); + get courseUnitsFiles => UnmodifiableMapView(state!.$3); Future fetchCourseUnitSheet( CourseUnit courseUnit, @@ -43,7 +42,7 @@ class CourseUnitsInfoProvider return; } - state!.item1[courseUnit] = + state!.$1[courseUnit] = await CourseUnitsInfoFetcher().fetchSheet(session, occurrId); } @@ -56,7 +55,7 @@ class CourseUnitsInfoProvider return; } - state!.item2[courseUnit] = await CourseUnitsInfoFetcher() + state!.$2[courseUnit] = await CourseUnitsInfoFetcher() .fetchCourseUnitClasses(session, occurrId); notifyListeners(); } @@ -70,22 +69,29 @@ class CourseUnitsInfoProvider return; } - state!.item3[courseUnit] = + state!.$3[courseUnit] = await CourseUnitsInfoFetcher().fetchCourseUnitFiles(session, occurrId); notifyListeners(); } @override - Future> loadFromRemote( + Future<(SheetsMap, ClassesMap, FilesMap)> loadFromRemote( StateProviders stateProviders, ) async { - return const Tuple3({}, {}, {}); + //return (sheetsMap, classesMap, filesMap); + return ({}, {}, {}); + //return const Tuple3({}, {}, {}); } @override - Future> loadFromStorage( + Future<(SheetsMap, ClassesMap, FilesMap)> loadFromStorage( StateProviders stateProviders, ) async { - return const Tuple3({}, {}, {}); + final SheetsMap sheetsMap = {}; + final ClassesMap classesMap = {}; + final FilesMap filesMap = {}; + return (sheetsMap, classesMap, filesMap); + //return ({}, {}, {}); + //return const Tuple3({}, {}, {}); } } diff --git a/packages/uni_app/lib/model/providers/startup/profile_provider.dart b/packages/uni_app/lib/model/providers/startup/profile_provider.dart index ad4ef1b02..2266aa581 100644 --- a/packages/uni_app/lib/model/providers/startup/profile_provider.dart +++ b/packages/uni_app/lib/model/providers/startup/profile_provider.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:io'; -import 'package:tuple/tuple.dart'; import 'package:uni/controller/fetchers/course_units_fetcher/all_course_units_fetcher.dart'; import 'package:uni/controller/fetchers/course_units_fetcher/current_course_units_fetcher.dart'; import 'package:uni/controller/fetchers/fees_fetcher.dart'; @@ -60,12 +59,12 @@ class ProfileProvider extends StateProviderNotifier { ]); final profile = futures[0] as Profile?; final courseUnits = futures[1] as List?; - final userBalanceAndFeesLimit = futures[2]! as Tuple2; + final userBalanceAndFeesLimit = futures[2]! as (String, DateTime?); final printBalance = futures[3]! as String; profile! - ..feesBalance = userBalanceAndFeesLimit.item1 - ..feesLimit = userBalanceAndFeesLimit.item2 + ..feesBalance = userBalanceAndFeesLimit.$1 + ..feesLimit = userBalanceAndFeesLimit.$2 ..printBalance = printBalance; if (courseUnits != null) { @@ -93,7 +92,7 @@ class ProfileProvider extends StateProviderNotifier { return db.courseUnits(); } - Future> fetchUserFeesBalanceAndLimit( + Future<(String, DateTime?)> fetchUserFeesBalanceAndLimit( Session session, ) async { final response = await FeesFetcher().getUserFeesResponse(session); @@ -101,7 +100,7 @@ class ProfileProvider extends StateProviderNotifier { final feesBalance = parseFeesBalance(response); final feesLimit = parseFeesNextLimit(response); - return Tuple2(feesBalance, feesLimit); + return (feesBalance, feesLimit); } Future fetchUserPrintBalance(Session session) async { diff --git a/packages/uni_app/lib/view/bug_report/widgets/form.dart b/packages/uni_app/lib/view/bug_report/widgets/form.dart index 7f9257e61..805d9308e 100644 --- a/packages/uni_app/lib/view/bug_report/widgets/form.dart +++ b/packages/uni_app/lib/view/bug_report/widgets/form.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:logger/logger.dart'; import 'package:provider/provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -import 'package:tuple/tuple.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/app_locale.dart'; import 'package:uni/model/entities/bug_report.dart'; @@ -32,15 +31,15 @@ class BugReportFormState extends State { static final _formKey = GlobalKey(); - final Map> bugDescriptions = { - 0: const Tuple2('Detalhe visual', 'Visual detail'), - 1: const Tuple2('Erro', 'Error'), - 2: const Tuple2('Sugestão de funcionalidade', 'Suggestion'), - 3: const Tuple2( + final Map bugDescriptions = { + 0: const ('Detalhe visual', 'Visual detail'), + 1: const ('Erro', 'Error'), + 2: const ('Sugestão de funcionalidade', 'Suggestion'), + 3: const ( 'Comportamento inesperado', 'Unexpected behaviour', ), - 4: const Tuple2('Outro', 'Other'), + 4: ('Outro', 'Other'), }; List> bugList = []; @@ -65,9 +64,9 @@ class BugReportFormState extends State { () { switch (locale) { case AppLocale.pt: - return entry.value.item1; + return entry.value.$1; case AppLocale.en: - return entry.value.item2; + return entry.value.$2; } }(), ), diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 7c5d3d057..329d02978 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -65,7 +65,6 @@ dependencies: sqflite: ^2.0.3 synchronized: ^3.0.0 timelines: ^0.1.0 - tuple: ^2.0.0 ua_client_hints: ^1.3.1 uni_ui: path: ../uni_ui From bf7c438f299458d760053ea7a5617f2d3e8cb50d Mon Sep 17 00:00:00 2001 From: jcovaa Date: Tue, 19 Nov 2024 17:38:37 +0000 Subject: [PATCH 077/100] correct version of the Future method --- .../providers/lazy/course_units_info_provider.dart | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart b/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart index ede2fee25..09caeb1aa 100644 --- a/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart +++ b/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart @@ -78,20 +78,13 @@ class CourseUnitsInfoProvider Future<(SheetsMap, ClassesMap, FilesMap)> loadFromRemote( StateProviders stateProviders, ) async { - //return (sheetsMap, classesMap, filesMap); - return ({}, {}, {}); - //return const Tuple3({}, {}, {}); + return ({}, >{}, >{}); } @override Future<(SheetsMap, ClassesMap, FilesMap)> loadFromStorage( StateProviders stateProviders, ) async { - final SheetsMap sheetsMap = {}; - final ClassesMap classesMap = {}; - final FilesMap filesMap = {}; - return (sheetsMap, classesMap, filesMap); - //return ({}, {}, {}); - //return const Tuple3({}, {}, {}); + return ({}, >{}, >{}); } } From 4be6dd468640f282a0d996bce26b2b525925bc5f Mon Sep 17 00:00:00 2001 From: jcovaa Date: Fri, 22 Nov 2024 12:15:19 +0000 Subject: [PATCH 078/100] Formatted files --- .../background_workers/background_callback.dart | 6 ++++-- .../background_workers/notifications.dart | 2 +- .../notifications/tuition_notification.dart | 2 +- .../fetchers/library_occupation_fetcher.dart | 3 +-- .../lazy/course_units_info_provider.dart | 12 ++++++++++-- packages/uni_app/pubspec.lock | 16 ++++++++-------- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/packages/uni_app/lib/controller/background_workers/background_callback.dart b/packages/uni_app/lib/controller/background_workers/background_callback.dart index 08c17414d..de75ab882 100644 --- a/packages/uni_app/lib/controller/background_workers/background_callback.dart +++ b/packages/uni_app/lib/controller/background_workers/background_callback.dart @@ -6,8 +6,10 @@ import 'package:workmanager/workmanager.dart'; /// the bool is all functions that are ran by backgroundfetch in iOS /// (they must not take any arguments, not checked) const taskMap = { - 'pt.up.fe.ni.uni.notificationworker': - (NotificationManager.updateAndTriggerNotifications, true), + 'pt.up.fe.ni.uni.notificationworker': ( + NotificationManager.updateAndTriggerNotifications, + true + ), }; @pragma('vm:entry-point') diff --git a/packages/uni_app/lib/controller/background_workers/notifications.dart b/packages/uni_app/lib/controller/background_workers/notifications.dart index b53cb29fa..795a37904 100644 --- a/packages/uni_app/lib/controller/background_workers/notifications.dart +++ b/packages/uni_app/lib/controller/background_workers/notifications.dart @@ -32,7 +32,7 @@ abstract class Notification { Future shouldDisplay(Session session); void displayNotification( - (String, String) content, + (String, String) content, FlutterLocalNotificationsPlugin localNotificationsPlugin, ); diff --git a/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart b/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart index 5ab9ccd1e..7cb4bdf6c 100644 --- a/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart +++ b/packages/uni_app/lib/controller/background_workers/notifications/tuition_notification.dart @@ -71,7 +71,7 @@ class TuitionNotification extends Notification { @override void displayNotification( - (String, String) content, + (String, String) content, FlutterLocalNotificationsPlugin localNotificationsPlugin, ) { const androidNotificationDetails = AndroidNotificationDetails( diff --git a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart index 088390844..610612dce 100644 --- a/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart +++ b/packages/uni_app/lib/controller/fetchers/library_occupation_fetcher.dart @@ -31,8 +31,7 @@ class LibraryOccupationFetcher { final response = await http.get(url); - final floorOccupation = - processFloorOccupation(response, entry.$2, i); + final floorOccupation = processFloorOccupation(response, entry.$2, i); libraryOccupation.addFloor(floorOccupation); }), diff --git a/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart b/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart index 09caeb1aa..eb4d7ea92 100644 --- a/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart +++ b/packages/uni_app/lib/model/providers/lazy/course_units_info_provider.dart @@ -78,13 +78,21 @@ class CourseUnitsInfoProvider Future<(SheetsMap, ClassesMap, FilesMap)> loadFromRemote( StateProviders stateProviders, ) async { - return ({}, >{}, >{}); + return ( + {}, + >{}, + >{} + ); } @override Future<(SheetsMap, ClassesMap, FilesMap)> loadFromStorage( StateProviders stateProviders, ) async { - return ({}, >{}, >{}); + return ( + {}, + >{}, + >{} + ); } } diff --git a/packages/uni_app/pubspec.lock b/packages/uni_app/pubspec.lock index 04778b73c..15cc3de07 100644 --- a/packages/uni_app/pubspec.lock +++ b/packages/uni_app/pubspec.lock @@ -1147,6 +1147,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.28.0" + scrollable_positioned_list: + dependency: transitive + description: + name: scrollable_positioned_list + sha256: "1b54d5f1329a1e263269abc9e2543d90806131aa14fe7c6062a8054d57249287" + url: "https://pub.dev" + source: hosted + version: "0.3.8" sentry: dependency: transitive description: @@ -1464,14 +1472,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - tuple: - dependency: "direct main" - description: - name: tuple - sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 - url: "https://pub.dev" - source: hosted - version: "2.0.2" typed_data: dependency: transitive description: From 15cb14bb0780874cb2aa3b076cb8fdf8c86862aa Mon Sep 17 00:00:00 2001 From: anabela17 Date: Mon, 25 Nov 2024 19:14:53 +0000 Subject: [PATCH 079/100] Finish Transitions --- packages/uni_app/lib/main.dart | 23 +++++++++++++++---- .../uni_app/lib/utils/navigation_items.dart | 5 +++- .../uni_app/lib/view/settings/settings.dart | 18 ++++++--------- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/packages/uni_app/lib/main.dart b/packages/uni_app/lib/main.dart index 410b31835..5d49aa944 100644 --- a/packages/uni_app/lib/main.dart +++ b/packages/uni_app/lib/main.dart @@ -31,7 +31,9 @@ import 'package:uni/model/providers/startup/profile_provider.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; import 'package:uni/model/providers/state_providers.dart'; import 'package:uni/utils/navigation_items.dart'; +import 'package:uni/view/about/about.dart'; import 'package:uni/view/academic_path/academic_path.dart'; +import 'package:uni/view/bug_report/bug_report.dart'; import 'package:uni/view/bus_stop_next_arrivals/bus_stop_next_arrivals.dart'; import 'package:uni/view/calendar/calendar.dart'; import 'package:uni/view/common_widgets/page_transition.dart'; @@ -305,13 +307,26 @@ class ApplicationState extends State { settings: settings, ), '/${NavigationItem.navProfile.route}': - MaterialPageRoute( - builder: (__) => const ProfilePageView(), + PageTransition.makePageTransition( + page: const ProfilePageView(), + settings: settings, ), '/${NavigationItem.navSettings.route}': - MaterialPageRoute( - builder: (_) => const SettingsPage(), + PageTransition.makePageTransition( + page: const SettingsPage(), + settings: settings, + ), + '/${NavigationItem. navBugreport.route}': + PageTransition.makePageTransition( + page: const BugReportPageView(), + settings: settings, ), + '/${NavigationItem. navAboutus.route}': + PageTransition.makePageTransition( + page: const AboutPageView(), + settings: settings, + ), + }; return transitions[settings.name]; }, diff --git a/packages/uni_app/lib/utils/navigation_items.dart b/packages/uni_app/lib/utils/navigation_items.dart index 2cc31d02c..3f2eb05c6 100644 --- a/packages/uni_app/lib/utils/navigation_items.dart +++ b/packages/uni_app/lib/utils/navigation_items.dart @@ -13,7 +13,10 @@ enum NavigationItem { navProfile('perfil'), navSettings('definicoes'), navTransports('transportes'), - navLogin('login'); + navLogin('login'), + navBugreport('Bug_report'), + navAboutus('sobre_nós'); + const NavigationItem(this.route, {this.faculties}); diff --git a/packages/uni_app/lib/view/settings/settings.dart b/packages/uni_app/lib/view/settings/settings.dart index ba48f5ab7..730d70b53 100644 --- a/packages/uni_app/lib/view/settings/settings.dart +++ b/packages/uni_app/lib/view/settings/settings.dart @@ -1,14 +1,14 @@ import 'package:flutter/material.dart'; import 'package:uni/controller/networking/network_router.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/view/about/about.dart'; -import 'package:uni/view/bug_report/bug_report.dart'; import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/settings/widgets/locale_switch_button.dart'; import 'package:uni/view/settings/widgets/notifications_dialog.dart'; import 'package:uni/view/settings/widgets/theme_switch_button.dart'; import 'package:uni/view/settings/widgets/usage_stats_switch.dart'; +import '../../utils/navigation_items.dart'; + class SettingsPage extends StatefulWidget { const SettingsPage({super.key}); @@ -55,11 +55,9 @@ class SettingsPageState extends SecondaryPageViewState { title: Text(S.of(context).report_error_suggestion), trailing: const Icon(Icons.arrow_forward_ios), onTap: () { - Navigator.push( + Navigator.pushNamed( context, - MaterialPageRoute( - builder: (context) => const BugReportPageView(), - ), + '/${NavigationItem. navBugreport.route}', ); }, ), @@ -67,12 +65,10 @@ class SettingsPageState extends SecondaryPageViewState { title: Text(S.of(context).about), trailing: const Icon(Icons.arrow_forward_ios), onTap: () { - Navigator.push( + Navigator.pushNamed( context, - MaterialPageRoute( - builder: (context) => const AboutPageView(), - ), - ); + '/${NavigationItem. navAboutus.route}', + ); }, ), ListTile( From fa0c0471a5d53ac4864e8ec2dfd8427b960b4ad9 Mon Sep 17 00:00:00 2001 From: anabela17 Date: Mon, 25 Nov 2024 19:31:42 +0000 Subject: [PATCH 080/100] Finish Transitions --- packages/uni_app/lib/main.dart | 13 ++++++------- packages/uni_app/lib/utils/navigation_items.dart | 1 - packages/uni_app/lib/view/settings/settings.dart | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/uni_app/lib/main.dart b/packages/uni_app/lib/main.dart index 5d49aa944..8ab6fe912 100644 --- a/packages/uni_app/lib/main.dart +++ b/packages/uni_app/lib/main.dart @@ -307,26 +307,25 @@ class ApplicationState extends State { settings: settings, ), '/${NavigationItem.navProfile.route}': - PageTransition.makePageTransition( + PageTransition.makePageTransition( page: const ProfilePageView(), settings: settings, ), '/${NavigationItem.navSettings.route}': - PageTransition.makePageTransition( + PageTransition.makePageTransition( page: const SettingsPage(), settings: settings, ), - '/${NavigationItem. navBugreport.route}': - PageTransition.makePageTransition( + '/${NavigationItem.navBugreport.route}': + PageTransition.makePageTransition( page: const BugReportPageView(), settings: settings, ), - '/${NavigationItem. navAboutus.route}': - PageTransition.makePageTransition( + '/${NavigationItem.navAboutus.route}': + PageTransition.makePageTransition( page: const AboutPageView(), settings: settings, ), - }; return transitions[settings.name]; }, diff --git a/packages/uni_app/lib/utils/navigation_items.dart b/packages/uni_app/lib/utils/navigation_items.dart index 3f2eb05c6..473c2b4af 100644 --- a/packages/uni_app/lib/utils/navigation_items.dart +++ b/packages/uni_app/lib/utils/navigation_items.dart @@ -17,7 +17,6 @@ enum NavigationItem { navBugreport('Bug_report'), navAboutus('sobre_nós'); - const NavigationItem(this.route, {this.faculties}); final String route; diff --git a/packages/uni_app/lib/view/settings/settings.dart b/packages/uni_app/lib/view/settings/settings.dart index 730d70b53..c326c2730 100644 --- a/packages/uni_app/lib/view/settings/settings.dart +++ b/packages/uni_app/lib/view/settings/settings.dart @@ -57,7 +57,7 @@ class SettingsPageState extends SecondaryPageViewState { onTap: () { Navigator.pushNamed( context, - '/${NavigationItem. navBugreport.route}', + '/${NavigationItem.navBugreport.route}', ); }, ), @@ -67,8 +67,8 @@ class SettingsPageState extends SecondaryPageViewState { onTap: () { Navigator.pushNamed( context, - '/${NavigationItem. navAboutus.route}', - ); + '/${NavigationItem.navAboutus.route}', + ); }, ), ListTile( From 87c6cc36a84044e408f500ef6203c21acd8f16b1 Mon Sep 17 00:00:00 2001 From: Pinho13 Date: Tue, 26 Nov 2024 13:11:54 +0000 Subject: [PATCH 081/100] Disposed Controllers in some common Widgets --- packages/uni_app/lib/view/bug_report/widgets/form.dart | 10 ++++++++++ packages/uni_app/lib/view/locations/locations.dart | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/packages/uni_app/lib/view/bug_report/widgets/form.dart b/packages/uni_app/lib/view/bug_report/widgets/form.dart index 7f9257e61..f070f2a16 100644 --- a/packages/uni_app/lib/view/bug_report/widgets/form.dart +++ b/packages/uni_app/lib/view/bug_report/widgets/form.dart @@ -321,4 +321,14 @@ class BugReportFormState extends State { _isConsentGiven = false; }); } + + @override + void dispose() { + titleController.dispose(); + descriptionController.dispose(); + emailController.dispose(); + + super.dispose(); + } + } diff --git a/packages/uni_app/lib/view/locations/locations.dart b/packages/uni_app/lib/view/locations/locations.dart index 0d8dd55b7..8051e5d1d 100644 --- a/packages/uni_app/lib/view/locations/locations.dart +++ b/packages/uni_app/lib/view/locations/locations.dart @@ -39,6 +39,12 @@ class LocationsPageState extends SecondaryPageViewState @override String? getTitle() => S.of(context).nav_title(NavigationItem.navLocations.route); + + @override + void dispose() { + scrollViewController?.dispose(); + super.dispose(); + } } class LocationsPageView extends StatefulWidget { From 0f9ce28d52c2344e8301f75b435b447b6f0d30cc Mon Sep 17 00:00:00 2001 From: Pinho13 Date: Tue, 26 Nov 2024 13:17:47 +0000 Subject: [PATCH 082/100] fix:Format --- packages/uni_app/lib/view/bug_report/widgets/form.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/uni_app/lib/view/bug_report/widgets/form.dart b/packages/uni_app/lib/view/bug_report/widgets/form.dart index f070f2a16..d0e5dcdd0 100644 --- a/packages/uni_app/lib/view/bug_report/widgets/form.dart +++ b/packages/uni_app/lib/view/bug_report/widgets/form.dart @@ -327,7 +327,6 @@ class BugReportFormState extends State { titleController.dispose(); descriptionController.dispose(); emailController.dispose(); - super.dispose(); } From 8e24cbaafa61330ccf9718122809efea8669b7a3 Mon Sep 17 00:00:00 2001 From: Pinho13 Date: Tue, 26 Nov 2024 13:25:02 +0000 Subject: [PATCH 083/100] fix: Format x2 --- packages/uni_app/lib/view/bug_report/widgets/form.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/uni_app/lib/view/bug_report/widgets/form.dart b/packages/uni_app/lib/view/bug_report/widgets/form.dart index d0e5dcdd0..5577eebca 100644 --- a/packages/uni_app/lib/view/bug_report/widgets/form.dart +++ b/packages/uni_app/lib/view/bug_report/widgets/form.dart @@ -329,5 +329,4 @@ class BugReportFormState extends State { emailController.dispose(); super.dispose(); } - } From 118c4702b2c16da86195ee9acee661d365006d21 Mon Sep 17 00:00:00 2001 From: anabela17 Date: Tue, 26 Nov 2024 16:19:29 +0000 Subject: [PATCH 084/100] corrected --- packages/uni_app/lib/utils/navigation_items.dart | 4 ++-- packages/uni_app/lib/view/settings/settings.dart | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/uni_app/lib/utils/navigation_items.dart b/packages/uni_app/lib/utils/navigation_items.dart index 473c2b4af..a31ff7b55 100644 --- a/packages/uni_app/lib/utils/navigation_items.dart +++ b/packages/uni_app/lib/utils/navigation_items.dart @@ -14,8 +14,8 @@ enum NavigationItem { navSettings('definicoes'), navTransports('transportes'), navLogin('login'), - navBugreport('Bug_report'), - navAboutus('sobre_nós'); + navBugreport('bug_report'), + navAboutus('sobre_nos'); const NavigationItem(this.route, {this.faculties}); diff --git a/packages/uni_app/lib/view/settings/settings.dart b/packages/uni_app/lib/view/settings/settings.dart index c326c2730..169d70b8e 100644 --- a/packages/uni_app/lib/view/settings/settings.dart +++ b/packages/uni_app/lib/view/settings/settings.dart @@ -1,14 +1,13 @@ import 'package:flutter/material.dart'; import 'package:uni/controller/networking/network_router.dart'; import 'package:uni/generated/l10n.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/settings/widgets/locale_switch_button.dart'; import 'package:uni/view/settings/widgets/notifications_dialog.dart'; import 'package:uni/view/settings/widgets/theme_switch_button.dart'; import 'package:uni/view/settings/widgets/usage_stats_switch.dart'; -import '../../utils/navigation_items.dart'; - class SettingsPage extends StatefulWidget { const SettingsPage({super.key}); From 7f2dc1b7ca83e38974f828310f8502a343e4883b Mon Sep 17 00:00:00 2001 From: Pedro Monteiro <83165668+pedroafmonteiro@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:26:36 +0000 Subject: [PATCH 085/100] Changed build.gradle to add the new suffix. Changed AndroidManifest.xml to change the app name based on release or debug version. --- packages/uni_app/android/app/build.gradle | 3 +++ packages/uni_app/android/app/src/debug/res/values/string.xml | 4 ++++ packages/uni_app/android/app/src/main/AndroidManifest.xml | 2 +- packages/uni_app/android/app/src/main/res/values/string.xml | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 packages/uni_app/android/app/src/debug/res/values/string.xml create mode 100644 packages/uni_app/android/app/src/main/res/values/string.xml diff --git a/packages/uni_app/android/app/build.gradle b/packages/uni_app/android/app/build.gradle index 30f18ecdd..a2f487422 100644 --- a/packages/uni_app/android/app/build.gradle +++ b/packages/uni_app/android/app/build.gradle @@ -76,6 +76,9 @@ android { "proguard-rules.pro" ) } + debug { + applicationIdSuffix ".debug" + } } } diff --git a/packages/uni_app/android/app/src/debug/res/values/string.xml b/packages/uni_app/android/app/src/debug/res/values/string.xml new file mode 100644 index 000000000..c16d9fe3b --- /dev/null +++ b/packages/uni_app/android/app/src/debug/res/values/string.xml @@ -0,0 +1,4 @@ + + + uni (debug) + diff --git a/packages/uni_app/android/app/src/main/AndroidManifest.xml b/packages/uni_app/android/app/src/main/AndroidManifest.xml index fbc9a782b..442afefcc 100644 --- a/packages/uni_app/android/app/src/main/AndroidManifest.xml +++ b/packages/uni_app/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ diff --git a/packages/uni_app/android/app/src/main/res/values/string.xml b/packages/uni_app/android/app/src/main/res/values/string.xml new file mode 100644 index 000000000..9e4a78d23 --- /dev/null +++ b/packages/uni_app/android/app/src/main/res/values/string.xml @@ -0,0 +1,4 @@ + + + uni + From 0ac33adef85ce4279c27c04b3c795291c736db76 Mon Sep 17 00:00:00 2001 From: Pedro Monteiro <83165668+pedroafmonteiro@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:38:01 +0000 Subject: [PATCH 086/100] Changed applicationIdSuffix to ".dev" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André Lima --- packages/uni_app/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uni_app/android/app/build.gradle b/packages/uni_app/android/app/build.gradle index a2f487422..96d940781 100644 --- a/packages/uni_app/android/app/build.gradle +++ b/packages/uni_app/android/app/build.gradle @@ -77,7 +77,7 @@ android { ) } debug { - applicationIdSuffix ".debug" + applicationIdSuffix ".dev" } } } From 8c5e78aebe0eec1725c7fb4221688a8c1bd6f161 Mon Sep 17 00:00:00 2001 From: Pedro Monteiro <83165668+pedroafmonteiro@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:38:31 +0000 Subject: [PATCH 087/100] Changed debug app name to "uni (dev)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André Lima --- packages/uni_app/android/app/src/debug/res/values/string.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uni_app/android/app/src/debug/res/values/string.xml b/packages/uni_app/android/app/src/debug/res/values/string.xml index c16d9fe3b..57a1e9693 100644 --- a/packages/uni_app/android/app/src/debug/res/values/string.xml +++ b/packages/uni_app/android/app/src/debug/res/values/string.xml @@ -1,4 +1,4 @@ - uni (debug) + uni (dev) From d785c54a0a195af04ed8b4ccf8ade8b55eaebcf9 Mon Sep 17 00:00:00 2001 From: pedroafmonteiro Date: Wed, 27 Nov 2024 10:50:57 +0000 Subject: [PATCH 088/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 464eac0ff..ebb8230d8 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.36+339 +1.10.0-beta.37+340 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index a9d41f398..15c0b3a48 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.36+339 +version: 1.10.0-beta.37+340 environment: sdk: ">=3.4.0 <4.0.0" From 37405edeb9ed3e1cdc5f08da073fa2d086cbbf87 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Wed, 27 Nov 2024 22:01:29 +0000 Subject: [PATCH 089/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index ebb8230d8..a75447c96 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.37+340 +1.10.0-beta.38+341 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 15c0b3a48..35b9e3419 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.37+340 +version: 1.10.0-beta.38+341 environment: sdk: ">=3.4.0 <4.0.0" From 2d7697decfcc06148a7585a93f41411a05c924d4 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Thu, 28 Nov 2024 20:31:45 +0000 Subject: [PATCH 090/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index a75447c96..7d394dc9f 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.38+341 +1.10.0-beta.39+342 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 35b9e3419..a5eccb509 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.38+341 +version: 1.10.0-beta.39+342 environment: sdk: ">=3.4.0 <4.0.0" From a7c88b75252babeb557b02d96f60b295bb6e2e36 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Fri, 29 Nov 2024 15:14:30 +0000 Subject: [PATCH 091/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 7d394dc9f..848ce2c79 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.39+342 +1.10.0-beta.40+343 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index a5eccb509..a5b72b56d 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.39+342 +version: 1.10.0-beta.40+343 environment: sdk: ">=3.4.0 <4.0.0" From 910651034a53ba328107933e5d592fefb0dfa0ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Tue, 15 Oct 2024 17:40:46 +0100 Subject: [PATCH 092/100] refactor: use inheritance for endpoints --- .../session/flows/credentials/request.dart | 27 ++++++++++++------- .../lib/session/flows/federated/request.dart | 9 +++---- packages/uni_app/lib/sigarra/endpoint.dart | 7 +++++ .../api/authentication/authentication.dart | 4 +-- .../api/authentication/login/login.dart | 20 ++++++++------ .../api/authentication/login/response.dart | 2 +- .../html/authentication/authentication.dart | 8 ++---- .../html/authentication/login/login.dart | 22 +++++++++------ .../html/authentication/login/response.dart | 2 +- .../html/authentication/logout/logout.dart | 18 ++++++++----- .../lib/sigarra/endpoints/oidc/oidc.dart | 4 +-- .../endpoints/oidc/token/response.dart | 2 +- .../sigarra/endpoints/oidc/token/token.dart | 14 +++++----- packages/uni_app/lib/sigarra/options.dart | 20 +++++++++++--- packages/uni_app/lib/sigarra/response.dart | 4 +-- 15 files changed, 97 insertions(+), 66 deletions(-) create mode 100644 packages/uni_app/lib/sigarra/endpoint.dart diff --git a/packages/uni_app/lib/session/flows/credentials/request.dart b/packages/uni_app/lib/session/flows/credentials/request.dart index cc658bd95..f5b0edbd7 100644 --- a/packages/uni_app/lib/session/flows/credentials/request.dart +++ b/packages/uni_app/lib/session/flows/credentials/request.dart @@ -73,11 +73,16 @@ class CredentialsSessionRequest extends SessionRequest { final api = SigarraApi(); const tempFaculty = 'feup'; - final loginResponse = await api.authentication.login.call( - username: username, - password: password, - options: FacultyRequestOptions(faculty: tempFaculty, client: httpClient), - ); + final loginResponse = await api.authentication + .login( + username: username, + password: password, + options: FacultyRequestOptions( + faculty: tempFaculty, + client: httpClient, + ), + ) + .call(); if (!loginResponse.success) { return null; @@ -98,11 +103,13 @@ class CredentialsSessionRequest extends SessionRequest { http.Client httpClient, ) async { final html = SigarraHtml(); - final response = await html.authentication.login.call( - username: username, - password: password, - options: FacultyRequestOptions(client: httpClient), - ); + final response = await html.authentication + .login( + username: username, + password: password, + options: FacultyRequestOptions(client: httpClient), + ) + .call(); final error = response.asFailed(); return error.reason; diff --git a/packages/uni_app/lib/session/flows/federated/request.dart b/packages/uni_app/lib/session/flows/federated/request.dart index 2c619623e..f7478b4ac 100644 --- a/packages/uni_app/lib/session/flows/federated/request.dart +++ b/packages/uni_app/lib/session/flows/federated/request.dart @@ -58,12 +58,9 @@ class FederatedSessionRequest extends SessionRequest { final authorizedClient = credential.createHttpClient(httpClient); final oidc = SigarraOidc(); - final response = await oidc.token - .call( - options: BaseRequestOptions( - client: authorizedClient, - ), - ) + final response = await oidc + .token(options: SigarraRequestOptions(client: authorizedClient)) + .call() .onError(_reportExceptionAndFail) .onError(_reportExceptionAndFail); diff --git a/packages/uni_app/lib/sigarra/endpoint.dart b/packages/uni_app/lib/sigarra/endpoint.dart new file mode 100644 index 000000000..5f082748e --- /dev/null +++ b/packages/uni_app/lib/sigarra/endpoint.dart @@ -0,0 +1,7 @@ +import 'package:uni/sigarra/response.dart'; + +abstract class Endpoint { + const Endpoint(); + + Future call(); +} diff --git a/packages/uni_app/lib/sigarra/endpoints/api/authentication/authentication.dart b/packages/uni_app/lib/sigarra/endpoints/api/authentication/authentication.dart index c112747a5..422710365 100644 --- a/packages/uni_app/lib/sigarra/endpoints/api/authentication/authentication.dart +++ b/packages/uni_app/lib/sigarra/endpoints/api/authentication/authentication.dart @@ -1,7 +1,5 @@ import 'package:uni/sigarra/endpoints/api/authentication/login/login.dart'; -import 'package:uni/utils/lazy.dart'; class SigarraApiAuthentication { - final _login = Lazy(() => const Login()); - Login get login => _login.value; + final login = Login.new; } diff --git a/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart b/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart index a8e179203..b8cc0bd2b 100644 --- a/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart +++ b/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart @@ -7,14 +7,18 @@ import 'package:uni/sigarra/endpoints/api/authentication/login/response.dart'; import 'package:uni/sigarra/options.dart'; class Login { - const Login(); - - Future call({ - required String username, - required String password, - required FacultyRequestOptions? options, - }) async { - options = options ?? FacultyRequestOptions(); + const Login({ + required this.username, + required this.password, + this.options, + }); + + final String username; + final String password; + final FacultyRequestOptions? options; + + Future call() async { + final options = this.options ?? FacultyRequestOptions(); final loginUrl = options.baseUrl.resolve('mob_val_geral.autentica'); diff --git a/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/response.dart b/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/response.dart index d91d38d63..74b945345 100644 --- a/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/response.dart +++ b/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/response.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:uni/sigarra/response.dart'; -abstract class LoginResponse extends SigarraResponse { +abstract class LoginResponse extends EndpointResponse { const LoginResponse({required super.success}); LoginSuccessfulResponse asSuccessful() => this as LoginSuccessfulResponse; diff --git a/packages/uni_app/lib/sigarra/endpoints/html/authentication/authentication.dart b/packages/uni_app/lib/sigarra/endpoints/html/authentication/authentication.dart index 6fe7810fa..797baea13 100644 --- a/packages/uni_app/lib/sigarra/endpoints/html/authentication/authentication.dart +++ b/packages/uni_app/lib/sigarra/endpoints/html/authentication/authentication.dart @@ -1,11 +1,7 @@ import 'package:uni/sigarra/endpoints/html/authentication/login/login.dart'; import 'package:uni/sigarra/endpoints/html/authentication/logout/logout.dart'; -import 'package:uni/utils/lazy.dart'; class SigarraHtmlAuthentication { - final _logout = Lazy(() => const Logout()); - Logout get logout => _logout.value; - - final _login = Lazy(() => const Login()); - Login get login => _login.value; + final logout = Logout.new; + final login = Login.new; } diff --git a/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/login.dart b/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/login.dart index a2760a4e2..728a125e9 100644 --- a/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/login.dart +++ b/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/login.dart @@ -4,18 +4,24 @@ import 'package:html/dom.dart' as html; import 'package:html/parser.dart' as html_parser; import 'package:http/http.dart' as http; import 'package:sentry_flutter/sentry_flutter.dart'; +import 'package:uni/sigarra/endpoint.dart'; import 'package:uni/sigarra/endpoints/html/authentication/login/response.dart'; import 'package:uni/sigarra/options.dart'; -class Login { - const Login(); +class Login extends Endpoint { + const Login({ + required this.username, + required this.password, + this.options, + }); - Future call({ - required String username, - required String password, - FacultyRequestOptions? options, - }) async { - options = options ?? FacultyRequestOptions(); + final String username; + final String password; + final FacultyRequestOptions? options; + + @override + Future call() async { + final options = this.options ?? FacultyRequestOptions(); final loginUrl = options.baseUrl.resolve('vld_validacao.validacao'); diff --git a/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart b/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart index dc8a26db1..1a3562b2f 100644 --- a/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart +++ b/packages/uni_app/lib/sigarra/endpoints/html/authentication/login/response.dart @@ -1,6 +1,6 @@ import 'package:uni/sigarra/response.dart'; -class LoginResponse extends SigarraResponse { +class LoginResponse extends EndpointResponse { const LoginResponse({required super.success}); LoginFailedResponse asFailed() => this as LoginFailedResponse; diff --git a/packages/uni_app/lib/sigarra/endpoints/html/authentication/logout/logout.dart b/packages/uni_app/lib/sigarra/endpoints/html/authentication/logout/logout.dart index f52fa1039..94237f82c 100644 --- a/packages/uni_app/lib/sigarra/endpoints/html/authentication/logout/logout.dart +++ b/packages/uni_app/lib/sigarra/endpoints/html/authentication/logout/logout.dart @@ -1,17 +1,21 @@ +import 'package:uni/sigarra/endpoint.dart'; import 'package:uni/sigarra/options.dart'; import 'package:uni/sigarra/response.dart'; -class Logout { - const Logout(); +class Logout extends Endpoint { + const Logout({ + this.options, + }); - Future call({ - FacultyRequestOptions? options, - }) async { - options = options ?? FacultyRequestOptions(); + final FacultyRequestOptions? options; + + @override + Future call() async { + final options = this.options ?? FacultyRequestOptions(); final logoutUrl = options.baseUrl.resolve('vld_validacao.sair'); final response = await options.client.get(logoutUrl); - return SigarraResponse(success: response.statusCode == 200); + return EndpointResponse(success: response.statusCode == 200); } } diff --git a/packages/uni_app/lib/sigarra/endpoints/oidc/oidc.dart b/packages/uni_app/lib/sigarra/endpoints/oidc/oidc.dart index 82201ffe3..c60fd65df 100644 --- a/packages/uni_app/lib/sigarra/endpoints/oidc/oidc.dart +++ b/packages/uni_app/lib/sigarra/endpoints/oidc/oidc.dart @@ -1,7 +1,5 @@ import 'package:uni/sigarra/endpoints/oidc/token/token.dart'; -import 'package:uni/utils/lazy.dart'; class SigarraOidc { - final _token = Lazy(Token.new); - Token get token => _token.value; + final token = Token.new; } diff --git a/packages/uni_app/lib/sigarra/endpoints/oidc/token/response.dart b/packages/uni_app/lib/sigarra/endpoints/oidc/token/response.dart index b549e321d..0edcfdf50 100644 --- a/packages/uni_app/lib/sigarra/endpoints/oidc/token/response.dart +++ b/packages/uni_app/lib/sigarra/endpoints/oidc/token/response.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:uni/sigarra/response.dart'; -class TokenResponse extends SigarraResponse { +class TokenResponse extends EndpointResponse { const TokenResponse({required super.success}); TokenSuccessfulResponse asSuccessful() => this as TokenSuccessfulResponse; diff --git a/packages/uni_app/lib/sigarra/endpoints/oidc/token/token.dart b/packages/uni_app/lib/sigarra/endpoints/oidc/token/token.dart index 309dd1de2..500efb41d 100644 --- a/packages/uni_app/lib/sigarra/endpoints/oidc/token/token.dart +++ b/packages/uni_app/lib/sigarra/endpoints/oidc/token/token.dart @@ -1,17 +1,19 @@ import 'package:uni/http/utils.dart'; +import 'package:uni/sigarra/endpoint.dart'; import 'package:uni/sigarra/endpoints/oidc/token/response.dart'; import 'package:uni/sigarra/options.dart'; -class Token { - const Token(); +class Token extends Endpoint { + const Token({this.options}); + + final SigarraRequestOptions? options; /// Returns the cookies for SIGARRA using the OIDC token. /// /// The client must be authorized to make this request. - Future call({ - BaseRequestOptions? options, - }) async { - options = options ?? BaseRequestOptions(); + @override + Future call() async { + final options = this.options ?? SigarraRequestOptions(); final tokenUrl = options.baseUrl.resolve('auth/oidc/token'); final response = await options.client.get( diff --git a/packages/uni_app/lib/sigarra/options.dart b/packages/uni_app/lib/sigarra/options.dart index 1e6f063ef..75e8e94d2 100644 --- a/packages/uni_app/lib/sigarra/options.dart +++ b/packages/uni_app/lib/sigarra/options.dart @@ -1,22 +1,34 @@ import 'package:http/http.dart' as http; -class BaseRequestOptions { +abstract class BaseRequestOptions { BaseRequestOptions({http.Client? client}) : client = client ?? http.Client(); final http.Client client; - Uri get baseUrl => Uri(scheme: 'https', host: 'sigarra.up.pt'); + Uri get baseUrl; BaseRequestOptions copyWith({ http.Client? client, + }); +} + +class SigarraRequestOptions extends BaseRequestOptions { + SigarraRequestOptions({super.client}); + + @override + Uri get baseUrl => Uri(scheme: 'https', host: 'sigarra.up.pt'); + + @override + SigarraRequestOptions copyWith({ + http.Client? client, }) { - return BaseRequestOptions( + return SigarraRequestOptions( client: client ?? this.client, ); } } -class FacultyRequestOptions extends BaseRequestOptions { +class FacultyRequestOptions extends SigarraRequestOptions { FacultyRequestOptions({ this.faculty = 'up', this.language = 'pt', diff --git a/packages/uni_app/lib/sigarra/response.dart b/packages/uni_app/lib/sigarra/response.dart index cfe91f221..aa7109021 100644 --- a/packages/uni_app/lib/sigarra/response.dart +++ b/packages/uni_app/lib/sigarra/response.dart @@ -1,5 +1,5 @@ -class SigarraResponse { - const SigarraResponse({required this.success}); +class EndpointResponse { + const EndpointResponse({required this.success}); final bool success; } From 06a30a270e22ff196357b1676d17e92bfa77c620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Sat, 30 Nov 2024 16:27:12 +0000 Subject: [PATCH 093/100] fix: make login endpoint extend endpoint --- .../lib/sigarra/endpoints/api/authentication/login/login.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart b/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart index b8cc0bd2b..0fbef6516 100644 --- a/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart +++ b/packages/uni_app/lib/sigarra/endpoints/api/authentication/login/login.dart @@ -2,11 +2,12 @@ import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:uni/http/utils.dart'; +import 'package:uni/sigarra/endpoint.dart'; import 'package:uni/sigarra/endpoints/api/authentication/login/json.dart'; import 'package:uni/sigarra/endpoints/api/authentication/login/response.dart'; import 'package:uni/sigarra/options.dart'; -class Login { +class Login extends Endpoint { const Login({ required this.username, required this.password, @@ -17,6 +18,7 @@ class Login { final String password; final FacultyRequestOptions? options; + @override Future call() async { final options = this.options ?? FacultyRequestOptions(); From 72953426a6d41cc88e540ebd70b0096b4df62222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Sat, 30 Nov 2024 18:06:40 +0000 Subject: [PATCH 094/100] chore: add nix flake --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..c084ad224 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1732758367, + "narHash": "sha256-RzaI1RO0UXqLjydtz3GAXSTzHkpb/lLD1JD8a0W4Wpo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fa42b5a5f401aab8a32bd33c9a4de0738180dc59", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..8e67f7ab6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + android_sdk.accept_license = true; + }; + }; + + androidComposition = pkgs.androidenv.composeAndroidPackages { + platformVersions = [ "31" "33" "34" ]; + buildToolsVersions = [ "34.0.0" ]; + includeNDK = true; + includeEmulator = true; + includeSystemImages = true; + }; + + androidSdk = androidComposition.androidsdk; + in { + + devShell.${system} = pkgs.mkShell { + packages = with pkgs; [ + flutter + jdk17 + androidSdk + ]; + + shellHook = '' + export ANDROID_HOME="${androidSdk}/libexec/android-sdk" + export JAVA_HOME="${pkgs.jdk17}" + ''; + }; + }; +} From fba44f29c050066aa9eecf46d6a43259377d4cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Sat, 30 Nov 2024 19:01:45 +0000 Subject: [PATCH 095/100] fix: app halting after installation --- packages/uni_app/android/app/src/main/AndroidManifest.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/android/app/src/main/AndroidManifest.xml b/packages/uni_app/android/app/src/main/AndroidManifest.xml index 442afefcc..aea4d5425 100644 --- a/packages/uni_app/android/app/src/main/AndroidManifest.xml +++ b/packages/uni_app/android/app/src/main/AndroidManifest.xml @@ -1,9 +1,11 @@ - + android:usesCleartextTraffic="true" + android:allowBackup="true" + > Date: Sat, 30 Nov 2024 19:26:45 +0000 Subject: [PATCH 096/100] fix: disallow backups --- packages/uni_app/android/app/src/main/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uni_app/android/app/src/main/AndroidManifest.xml b/packages/uni_app/android/app/src/main/AndroidManifest.xml index aea4d5425..62f6f057e 100644 --- a/packages/uni_app/android/app/src/main/AndroidManifest.xml +++ b/packages/uni_app/android/app/src/main/AndroidManifest.xml @@ -4,7 +4,7 @@ android:name="${applicationName}" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true" - android:allowBackup="true" + android:allowBackup="false" > Date: Tue, 3 Dec 2024 11:48:09 +0000 Subject: [PATCH 097/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 848ce2c79..60f420226 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.40+343 +1.10.0-beta.41+344 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index a5b72b56d..ba4854edb 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.40+343 +version: 1.10.0-beta.41+344 environment: sdk: ">=3.4.0 <4.0.0" From b5002b732bf62c62a9aaa43b43c8f5d7fccfb1d9 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Tue, 3 Dec 2024 11:55:41 +0000 Subject: [PATCH 098/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 60f420226..693299e3a 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.41+344 +1.10.0-beta.42+345 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index ba4854edb..58819cb8e 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.41+344 +version: 1.10.0-beta.42+345 environment: sdk: ">=3.4.0 <4.0.0" From a5c5366f2abf32be1b116d790b6497d6580775ef Mon Sep 17 00:00:00 2001 From: limwa Date: Tue, 3 Dec 2024 14:11:38 +0000 Subject: [PATCH 099/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index 693299e3a..b1793fd38 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.42+345 +1.10.0-beta.43+346 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 58819cb8e..5e84a6d8b 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.42+345 +version: 1.10.0-beta.43+346 environment: sdk: ">=3.4.0 <4.0.0" From 52aaba8324c18eb09516ba609edf8c15d6cc9465 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Wed, 4 Dec 2024 22:04:15 +0000 Subject: [PATCH 100/100] Bump app version [no ci] --- packages/uni_app/app_version.txt | 2 +- packages/uni_app/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uni_app/app_version.txt b/packages/uni_app/app_version.txt index b1793fd38..d0778cef3 100644 --- a/packages/uni_app/app_version.txt +++ b/packages/uni_app/app_version.txt @@ -1 +1 @@ -1.10.0-beta.43+346 +1.10.0-beta.44+347 diff --git a/packages/uni_app/pubspec.yaml b/packages/uni_app/pubspec.yaml index 9359deae0..c0574e524 100644 --- a/packages/uni_app/pubspec.yaml +++ b/packages/uni_app/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.10.0-beta.43+346 +version: 1.10.0-beta.44+347 environment: sdk: ">=3.4.0 <4.0.0"