From 122b6c378f596f00d53e0858a052399112d89827 Mon Sep 17 00:00:00 2001 From: M123-dev Date: Fri, 29 Oct 2021 16:27:17 +0200 Subject: [PATCH 1/2] fix: fix contributors dialog --- .../data_models/github_contributors_model.dart | 2 +- .../user_contribution_view.dart | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/smooth_app/lib/data_models/github_contributors_model.dart b/packages/smooth_app/lib/data_models/github_contributors_model.dart index fc356c24db4..a0ece2e1474 100644 --- a/packages/smooth_app/lib/data_models/github_contributors_model.dart +++ b/packages/smooth_app/lib/data_models/github_contributors_model.dart @@ -1,7 +1,7 @@ class ContributorsModel { ContributorsModel({required this.avatarUrl, required this.profilePath}); - ContributorsModel.fromJson(Map json) + ContributorsModel.fromJson(Map json) : profilePath = json['html_url'].toString(), avatarUrl = json['avatar_url'].toString(); diff --git a/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart b/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart index 3a7ba392865..2273b8facc0 100644 --- a/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart +++ b/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart @@ -1,4 +1,5 @@ -import 'dart:convert' as convert; +import 'dart:convert'; + import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:http/http.dart' as http; @@ -239,19 +240,23 @@ class UserContributionView extends StatelessWidget { ); } - Future _contributors(BuildContext context) async { + Future _contributors(BuildContext context) { return showDialog( context: context, builder: (BuildContext context) { return SmoothAlertDialog( title: AppLocalizations.of(context)!.contributors, body: FutureBuilder( - future: http.get(Uri.https('api.github.com', - '/repos/openfoodfacts/smooth-app/contributors')), + future: http.get( + Uri.https( + 'api.github.com', + '/repos/openfoodfacts/smooth-app/contributors', + ), + ), builder: (BuildContext context, AsyncSnapshot snap) { if (snap.hasData) { final List contributors = - convert.jsonDecode(snap.data!.body) as List; + jsonDecode(snap.data!.body) as List; return SingleChildScrollView( child: Wrap( @@ -259,7 +264,7 @@ class UserContributionView extends StatelessWidget { children: contributors.map((dynamic contributorsData) { final ContributorsModel _contributor = ContributorsModel.fromJson( - contributorsData as Map); + contributorsData as Map); return Padding( padding: const EdgeInsets.all(5.0), @@ -271,7 +276,6 @@ class UserContributionView extends StatelessWidget { child: CircleAvatar( foregroundImage: NetworkImage(_contributor.avatarUrl), - backgroundColor: Colors.brown.shade800, ), ), ); From 1692ad69c3f1f9a1299621c706346f3e4cafdedb Mon Sep 17 00:00:00 2001 From: M123-dev Date: Fri, 29 Oct 2021 16:45:45 +0200 Subject: [PATCH 2/2] Update user_contribution_view.dart --- .../lib/views/bottom_sheet_views/user_contribution_view.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart b/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart index 2273b8facc0..3db3716f767 100644 --- a/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart +++ b/packages/smooth_app/lib/views/bottom_sheet_views/user_contribution_view.dart @@ -276,6 +276,8 @@ class UserContributionView extends StatelessWidget { child: CircleAvatar( foregroundImage: NetworkImage(_contributor.avatarUrl), + backgroundColor: + Theme.of(context).colorScheme.primary, ), ), );