From 91bf37482231d0857c00fc85e4eba170eaaf7b05 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Sun, 12 Jun 2022 18:14:05 +0530 Subject: [PATCH 1/3] fixed broken albums on ipad --- .vscode/launch.json | 31 ++++++++++++++++++++++++++ lib/ui/collections_gallery_widget.dart | 12 +++++++--- lib/ui/shared_collections_gallery.dart | 31 +++++++++++++++++--------- 3 files changed, 60 insertions(+), 14 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 974de11cb..0355f5b2a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { "name": "Android Prod", "request": "launch", @@ -46,5 +47,35 @@ "endpoint=http://localhost:8080", ] }, + { + "name": "Tab", + "request": "launch", + "type": "dart", + "deviceId": "emulator-5554", + "flutterMode": "debug", + "program": "lib/main.dart", + "args": [ + "--flavor", + "independent" + ] + }, + { + "name": "Phone", + "request": "launch", + "type": "dart", + "deviceId": "emulator-5556", + "flutterMode": "debug", + "program": "lib/main.dart", + "args": [ + "--flavor", + "independent" + ] + } + ], + "compounds": [ + { + "name": "Tab and Phone", + "configurations": ["Tab", "Phone"] + } ] } \ No newline at end of file diff --git a/lib/ui/collections_gallery_widget.dart b/lib/ui/collections_gallery_widget.dart index d037ffb6a..1d6aeeb9f 100644 --- a/lib/ui/collections_gallery_widget.dart +++ b/lib/ui/collections_gallery_widget.dart @@ -142,7 +142,7 @@ class _CollectionsGalleryWidgetState extends State ); Size size = MediaQuery.of(context).size; int albumsCountInOneRow = max(size.width ~/ 220.0, 2); - final double sideOfThumbnail = (size.width / 2) - + final double sideOfThumbnail = (size.width / albumsCountInOneRow) - horizontalPaddingOfGridRow - ((crossAxisSpacingOfGrid / 2) * (albumsCountInOneRow - 1)); return SingleChildScrollView( @@ -643,10 +643,16 @@ class CollectionItem extends StatelessWidget { @override Widget build(BuildContext context) { + const double horizontalPaddingOfGridRow = 16; + const double crossAxisSpacingOfGrid = 5; + Size size = MediaQuery.of(context).size; + int albumsCountInOneRow = max(size.width ~/ 220.0, 2); + double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) + + (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid; TextStyle albumTitleTextStyle = Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 14); - final double sideOfThumbnail = - (MediaQuery.of(context).size.width / 2) - 18.5; + final double sideOfThumbnail = (size.width / albumsCountInOneRow) - + (totalWhiteSpaceOfRow / albumsCountInOneRow); return GestureDetector( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/shared_collections_gallery.dart b/lib/ui/shared_collections_gallery.dart index ef5d985af..07a48c1f5 100644 --- a/lib/ui/shared_collections_gallery.dart +++ b/lib/ui/shared_collections_gallery.dart @@ -115,9 +115,10 @@ class _SharedCollectionGalleryState extends State const double crossAxisSpacingOfGrid = 5; Size size = MediaQuery.of(context).size; int albumsCountInOneRow = max(size.width ~/ 220.0, 2); - final double sideOfThumbnail = (size.width / 2) - - horizontalPaddingOfGridRow - - ((crossAxisSpacingOfGrid / 2) * (albumsCountInOneRow - 1)); + double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) + + (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid; + final double sideOfThumbnail = (size.width / albumsCountInOneRow) - + (totalWhiteSpaceOfRow / albumsCountInOneRow); return SingleChildScrollView( child: Container( margin: const EdgeInsets.only(bottom: 50), @@ -391,10 +392,16 @@ class IncomingCollectionItem extends StatelessWidget { @override Widget build(BuildContext context) { + const double horizontalPaddingOfGridRow = 16; + const double crossAxisSpacingOfGrid = 5; TextStyle albumTitleTextStyle = Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 14); - final double sideOfThumbnail = - (MediaQuery.of(context).size.width / 2) - 18.5; + Size size = MediaQuery.of(context).size; + int albumsCountInOneRow = max(size.width ~/ 220.0, 2); + double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) + + (albumsCountInOneRow - 1) * crossAxisSpacingOfGrid; + final double sideOfThumbnail = (size.width / albumsCountInOneRow) - + (totalWhiteSpaceOfRow / albumsCountInOneRow); return GestureDetector( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -451,14 +458,16 @@ class IncomingCollectionItem extends StatelessWidget { builder: (context, snapshot) { if (snapshot.hasData && snapshot.data > 0) { return RichText( - text: TextSpan( - style: albumTitleTextStyle.copyWith( - color: - albumTitleTextStyle.color.withOpacity(0.5)), - children: [ + text: TextSpan( + style: albumTitleTextStyle.copyWith( + color: albumTitleTextStyle.color.withOpacity(0.5), + ), + children: [ TextSpan(text: " \u2022 "), TextSpan(text: snapshot.data.toString()), - ])); + ], + ), + ); } else { return Container(); } From 5bece69d47ae644f2a55d884440381bb45f05cc1 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Sun, 12 Jun 2022 19:52:05 +0530 Subject: [PATCH 2/3] changed spacing of grid from 5px to 9px --- lib/ui/collections_gallery_widget.dart | 5 ++--- lib/ui/shared_collections_gallery.dart | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/ui/collections_gallery_widget.dart b/lib/ui/collections_gallery_widget.dart index 1d6aeeb9f..c87e9ceba 100644 --- a/lib/ui/collections_gallery_widget.dart +++ b/lib/ui/collections_gallery_widget.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:logging/logging.dart'; import 'package:photos/core/configuration.dart'; @@ -133,7 +132,7 @@ class _CollectionsGalleryWidgetState extends State Widget _getCollectionsGalleryWidget(CollectionItems items) { const double horizontalPaddingOfGridRow = 16; - const double crossAxisSpacingOfGrid = 5; + const double crossAxisSpacingOfGrid = 9; final TextStyle trashAndHiddenTextStyle = Theme.of(context) .textTheme .subtitle1 @@ -644,7 +643,7 @@ class CollectionItem extends StatelessWidget { @override Widget build(BuildContext context) { const double horizontalPaddingOfGridRow = 16; - const double crossAxisSpacingOfGrid = 5; + const double crossAxisSpacingOfGrid = 9; Size size = MediaQuery.of(context).size; int albumsCountInOneRow = max(size.width ~/ 220.0, 2); double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) + diff --git a/lib/ui/shared_collections_gallery.dart b/lib/ui/shared_collections_gallery.dart index 07a48c1f5..0f88a0eea 100644 --- a/lib/ui/shared_collections_gallery.dart +++ b/lib/ui/shared_collections_gallery.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:logging/logging.dart'; import 'package:photos/core/configuration.dart'; @@ -112,7 +111,7 @@ class _SharedCollectionGalleryState extends State Widget _getSharedCollectionsGallery(SharedCollections collections) { const double horizontalPaddingOfGridRow = 16; - const double crossAxisSpacingOfGrid = 5; + const double crossAxisSpacingOfGrid = 9; Size size = MediaQuery.of(context).size; int albumsCountInOneRow = max(size.width ~/ 220.0, 2); double totalWhiteSpaceOfRow = (horizontalPaddingOfGridRow * 2) + @@ -393,7 +392,7 @@ class IncomingCollectionItem extends StatelessWidget { @override Widget build(BuildContext context) { const double horizontalPaddingOfGridRow = 16; - const double crossAxisSpacingOfGrid = 5; + const double crossAxisSpacingOfGrid = 9; TextStyle albumTitleTextStyle = Theme.of(context).textTheme.subtitle1.copyWith(fontSize: 14); Size size = MediaQuery.of(context).size; From b3c34b38cd371627dda6faafc9b1ff67e3e5c328 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Sun, 12 Jun 2022 20:06:49 +0530 Subject: [PATCH 3/3] minor fix --- .vscode/launch.json | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0355f5b2a..f661bd9bb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,7 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - + { "name": "Android Prod", "request": "launch", @@ -47,35 +47,5 @@ "endpoint=http://localhost:8080", ] }, - { - "name": "Tab", - "request": "launch", - "type": "dart", - "deviceId": "emulator-5554", - "flutterMode": "debug", - "program": "lib/main.dart", - "args": [ - "--flavor", - "independent" - ] - }, - { - "name": "Phone", - "request": "launch", - "type": "dart", - "deviceId": "emulator-5556", - "flutterMode": "debug", - "program": "lib/main.dart", - "args": [ - "--flavor", - "independent" - ] - } - ], - "compounds": [ - { - "name": "Tab and Phone", - "configurations": ["Tab", "Phone"] - } ] } \ No newline at end of file