Skip to content

Commit

Permalink
[BOT] Applying format.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlcl180 authored and github-actions[bot] committed Jun 29, 2024
1 parent b4c34c8 commit 737ab1c
Show file tree
Hide file tree
Showing 27 changed files with 196 additions and 146 deletions.
22 changes: 15 additions & 7 deletions lib/features/ets/events/author/author_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class AuthorView extends StatelessWidget {

const AuthorView({required this.authorId, super.key});

Widget _buildErrorWidget(PagingController<int, News> pagingController, BuildContext context) {
Widget _buildErrorWidget(
PagingController<int, News> pagingController, BuildContext context) {
return Scaffold(
body: SafeArea(
minimum: const EdgeInsets.all(20),
Expand Down Expand Up @@ -83,7 +84,8 @@ class AuthorView extends StatelessWidget {
content: Text(AppIntl.of(context)!.news_error_not_found),
action: SnackBarAction(
label: AppIntl.of(context)!.retry,
onPressed: () => model.pagingController.retryLastFailedRequest(),
onPressed: () =>
model.pagingController.retryLastFailedRequest(),
),
),
);
Expand All @@ -94,7 +96,8 @@ class AuthorView extends StatelessWidget {
return BaseScaffold(
showBottomBar: false,
body: RefreshIndicator(
onRefresh: () => Future.sync(() => model.pagingController.refresh()),
onRefresh: () =>
Future.sync(() => model.pagingController.refresh()),
child: Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child: Padding(
Expand All @@ -116,10 +119,15 @@ class AuthorView extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(0, 4, 0, 8),
builderDelegate: PagedChildBuilderDelegate<News>(
itemBuilder: (context, item, index) => NewsCard(item),
firstPageProgressIndicatorBuilder: (context) => NewsCardSkeleton(),
newPageProgressIndicatorBuilder: (context) => NewsCardSkeleton(),
noMoreItemsIndicatorBuilder: (context) => const NoMoreNewsCardWidget(),
firstPageErrorIndicatorBuilder: (context) => _buildErrorWidget(model.pagingController, context),
firstPageProgressIndicatorBuilder: (context) =>
NewsCardSkeleton(),
newPageProgressIndicatorBuilder: (context) =>
NewsCardSkeleton(),
noMoreItemsIndicatorBuilder: (context) =>
const NoMoreNewsCardWidget(),
firstPageErrorIndicatorBuilder: (context) =>
_buildErrorWidget(
model.pagingController, context),
),
),
),
Expand Down
6 changes: 4 additions & 2 deletions lib/features/ets/events/author/author_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class AuthorViewModel extends BaseViewModel implements Initialisable {
Organizer? _author;
Organizer? get author => _author;

final PagingController<int, News> pagingController = PagingController(firstPageKey: 1);
final PagingController<int, News> pagingController =
PagingController(firstPageKey: 1);

AuthorViewModel({required this.authorId, required this.appIntl});

Expand All @@ -33,7 +34,8 @@ class AuthorViewModel extends BaseViewModel implements Initialisable {

Future<void> fetchPage(int pageNumber) async {
try {
final pagination = await _newsRepository.getNews(pageNumber: pageNumber, organizerId: authorId);
final pagination = await _newsRepository.getNews(
pageNumber: pageNumber, organizerId: authorId);
final isLastPage = pagination?.totalPages == pageNumber;
if (isLastPage) {
pagingController.appendLastPage(pagination?.news ?? []);
Expand Down
59 changes: 41 additions & 18 deletions lib/features/ets/events/author/widget/author_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@ class AuthorInfoWidget extends ViewModelWidget<AuthorViewModel> {
List<SocialLink> socialLinks = [];
if (author != null) {
socialLinks = [
if (author.email != null) SocialLink(id: 0, name: 'Email', link: author.email!),
if (author.facebookLink != null) SocialLink(id: 1, name: 'Facebook', link: author.facebookLink!),
if (author.instagramLink != null) SocialLink(id: 2, name: 'Instagram', link: author.instagramLink!),
if (author.tikTokLink != null) SocialLink(id: 3, name: 'TikTok', link: author.tikTokLink!),
if (author.xLink != null) SocialLink(id: 4, name: 'X', link: author.xLink!),
if (author.redditLink != null) SocialLink(id: 5, name: 'Reddit', link: author.redditLink!),
if (author.discordLink != null) SocialLink(id: 6, name: 'Discord', link: author.discordLink!),
if (author.linkedInLink != null) SocialLink(id: 7, name: 'LinkedIn', link: author.linkedInLink!),
if (author.email != null)
SocialLink(id: 0, name: 'Email', link: author.email!),
if (author.facebookLink != null)
SocialLink(id: 1, name: 'Facebook', link: author.facebookLink!),
if (author.instagramLink != null)
SocialLink(id: 2, name: 'Instagram', link: author.instagramLink!),
if (author.tikTokLink != null)
SocialLink(id: 3, name: 'TikTok', link: author.tikTokLink!),
if (author.xLink != null)
SocialLink(id: 4, name: 'X', link: author.xLink!),
if (author.redditLink != null)
SocialLink(id: 5, name: 'Reddit', link: author.redditLink!),
if (author.discordLink != null)
SocialLink(id: 6, name: 'Discord', link: author.discordLink!),
if (author.linkedInLink != null)
SocialLink(id: 7, name: 'LinkedIn', link: author.linkedInLink!),
];
}

Expand All @@ -36,29 +44,38 @@ class AuthorInfoWidget extends ViewModelWidget<AuthorViewModel> {
: SizedBox(
width: double.infinity,
child: Card(
color: Utils.getColorByBrightnessNullable(context, AppTheme.newsSecondaryColor, null),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
color: Utils.getColorByBrightnessNullable(
context, AppTheme.newsSecondaryColor, null),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)),
child: Container(
padding: const EdgeInsets.fromLTRB(32, 64, 32, 16),
child: Column(
children: [
if (author?.organization != null || author?.organization != "")
if (author?.organization != null ||
author?.organization != "")
Text(
author?.organization ?? "",
style: const TextStyle(fontSize: 26),
),
if (author?.organization != null && author?.organization != "")
if (author?.organization != null &&
author?.organization != "")
const SizedBox(height: 8),
if (author?.profileDescription != null && author?.profileDescription != "")
if (author?.profileDescription != null &&
author?.profileDescription != "")
Text(
author?.profileDescription ?? "",
style: TextStyle(
color: Utils.getColorByBrightness(context, AppTheme.etsDarkGrey, AppTheme.newsSecondaryColor),
color: Utils.getColorByBrightness(
context,
AppTheme.etsDarkGrey,
AppTheme.newsSecondaryColor),
fontSize: 16,
),
textAlign: TextAlign.center,
),
if (author?.profileDescription != null && author?.profileDescription != "")
if (author?.profileDescription != null &&
author?.profileDescription != "")
const SizedBox(height: 8),
IconButton(
onPressed: () async {
Expand All @@ -68,14 +85,20 @@ class AuthorInfoWidget extends ViewModelWidget<AuthorViewModel> {
isScrollControlled: true,
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10)),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10)),
),
builder: (context) => SocialLinks(socialLinks: socialLinks),
builder: (context) =>
SocialLinks(socialLinks: socialLinks),
);
},
icon: FaIcon(
FontAwesomeIcons.link,
color: Utils.getColorByBrightness(context, AppTheme.newsAccentColorLight, AppTheme.newsAccentColorDark),
color: Utils.getColorByBrightness(
context,
AppTheme.newsAccentColorLight,
AppTheme.newsAccentColorDark),
),
),
],
Expand Down
22 changes: 15 additions & 7 deletions lib/features/ets/events/author/widget/avatar_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ class AvatarWidget extends ViewModelWidget<AuthorViewModel> {
child: Hero(
tag: 'news_author_avatar',
child: CircleAvatar(
backgroundColor: Utils.getColorByBrightness(
context, AppTheme.lightThemeAccent, AppTheme.darkThemeAccent),
backgroundColor: Utils.getColorByBrightness(context,
AppTheme.lightThemeAccent, AppTheme.darkThemeAccent),
child: Stack(
fit: StackFit.expand,
children: [
if (model.author?.avatarUrl != null && model.author!.avatarUrl != "")
if (model.author?.avatarUrl != null &&
model.author!.avatarUrl != "")
ClipRRect(
borderRadius: BorderRadius.circular(120),
child: Image.network(
Expand All @@ -36,22 +37,29 @@ class AvatarWidget extends ViewModelWidget<AuthorViewModel> {
errorBuilder: (context, error, stackTrace) {
return Center(
child: Text(
model.author?.organization?.substring(0, 1) ?? '',
model.author?.organization
?.substring(0, 1) ??
'',
style: TextStyle(
fontSize: 56,
color: Utils.getColorByBrightness(context, Colors.black, Colors.white)),
color: Utils.getColorByBrightness(
context,
Colors.black,
Colors.white)),
),
);
},
),
),
if (model.author?.avatarUrl == null || model.author!.avatarUrl == "")
if (model.author?.avatarUrl == null ||
model.author!.avatarUrl == "")
Center(
child: Text(
model.author?.organization?.substring(0, 1) ?? '',
style: TextStyle(
fontSize: 56,
color: Utils.getColorByBrightness(context, Colors.black, Colors.white)),
color: Utils.getColorByBrightness(
context, Colors.black, Colors.white)),
),
),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


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

Expand All @@ -16,7 +15,8 @@ class NoMoreNewsCardWidget extends StatelessWidget {
),
const SizedBox(height: 16),
Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 16),
child: Column(
Expand All @@ -33,7 +33,8 @@ class NoMoreNewsCardWidget extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(AppIntl.of(context)!.news_no_more_card_title, style: const TextStyle(fontSize: 24)),
Text(AppIntl.of(context)!.news_no_more_card_title,
style: const TextStyle(fontSize: 24)),
const SizedBox(height: 16),
Text(
AppIntl.of(context)!.news_no_more_card,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class _EmergencyViewState extends State<EmergencyView> {
floatingActionButton: const EmergencyFloatingButton(),
body: WebViewWidget(
controller: WebViewControllerExtension(WebViewController())
..loadHtmlFromAssets(widget.description, Theme.of(context).brightness),
..loadHtmlFromAssets(
widget.description, Theme.of(context).brightness),
),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class EmergencyFloatingButton extends StatelessWidget {
Widget build(BuildContext context) {
return FloatingActionButton.extended(
onPressed: () {
Utils.launchURL(
'tel:${AppIntl.of(context)!.security_emergency_number}',
Utils.launchURL('tel:${AppIntl.of(context)!.security_emergency_number}',
AppIntl.of(context)!)
.catchError((error) {
ScaffoldMessenger.of(context)
Expand Down
99 changes: 50 additions & 49 deletions lib/features/more/about/about_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:notredame/features/more/about/widget/easter_egg_icon.dart'; // Importez le widget extrait
import 'package:notredame/features/more/about/widget/social_icons_row.dart'; // Importez le widget extrait


class AboutView extends StatefulWidget {
@override
_AboutViewState createState() => _AboutViewState();
Expand Down Expand Up @@ -51,58 +50,60 @@ class _AboutViewState extends State<AboutView> with TickerProviderStateMixin {

Scaffold newMethod(BuildContext context) {
return Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
foregroundColor: Colors.white,
title: Text(
AppIntl.of(context)!.more_about_applets_title,
),
elevation: 0,
backgroundColor: Colors.transparent,
),
body: Stack(children: [
Positioned(
top: -(MediaQuery.of(context).size.height / 2) - 100,
bottom: 0,
right: 0,
left: 0,
child: OverflowBox(
maxHeight: MediaQuery.of(context).size.longestSide * 2,
maxWidth: MediaQuery.of(context).size.longestSide * 2,
minHeight: 0,
minWidth: 0,
child: AnimatedContainer(
duration: const Duration(seconds: 1),
width: _completed ? MediaQuery.of(context).size.longestSide * 2 : 0,
height: _completed ? MediaQuery.of(context).size.longestSide * 2 : 0,
decoration: const BoxDecoration(
color: Color.fromARGB(255, 25, 55, 95),
shape: BoxShape.circle),
),
extendBodyBehindAppBar: true,
appBar: AppBar(
foregroundColor: Colors.white,
title: Text(
AppIntl.of(context)!.more_about_applets_title,
),
elevation: 0,
backgroundColor: Colors.transparent,
),
Positioned(
top: 100,
right: 0,
left: 0,
child: Column(
children: [
EasterEggIcon(
toggleTrigger: toggleTrigger,
easterEggTrigger: _easterEggTrigger,
body: Stack(children: [
Positioned(
top: -(MediaQuery.of(context).size.height / 2) - 100,
bottom: 0,
right: 0,
left: 0,
child: OverflowBox(
maxHeight: MediaQuery.of(context).size.longestSide * 2,
maxWidth: MediaQuery.of(context).size.longestSide * 2,
minHeight: 0,
minWidth: 0,
child: AnimatedContainer(
duration: const Duration(seconds: 1),
width:
_completed ? MediaQuery.of(context).size.longestSide * 2 : 0,
height:
_completed ? MediaQuery.of(context).size.longestSide * 2 : 0,
decoration: const BoxDecoration(
color: Color.fromARGB(255, 25, 55, 95),
shape: BoxShape.circle),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
AppIntl.of(context)!.more_applets_about_details,
style: const TextStyle(color: Colors.white),
),
),
Positioned(
top: 100,
right: 0,
left: 0,
child: Column(
children: [
EasterEggIcon(
toggleTrigger: toggleTrigger,
easterEggTrigger: _easterEggTrigger,
),
),
const SocialIconsRow(),
],
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
AppIntl.of(context)!.more_applets_about_details,
style: const TextStyle(color: Colors.white),
),
),
const SocialIconsRow(),
],
),
),
),
]),
);
]),
);
}
}
3 changes: 2 additions & 1 deletion lib/features/more/about/widget/easter_egg_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class EasterEggIcon extends StatelessWidget {
final Function toggleTrigger;
final bool easterEggTrigger;

const EasterEggIcon({required this.toggleTrigger, required this.easterEggTrigger});
const EasterEggIcon(
{required this.toggleTrigger, required this.easterEggTrigger});

@override
Widget build(BuildContext context) {
Expand Down
Loading

0 comments on commit 737ab1c

Please sign in to comment.