change maxWidth in such a way than there will only be 2 or 4 or 6 or 8 or.... memories in header with increase in width of screen

This commit is contained in:
ashilkn 2024-01-17 11:39:36 +05:30
parent 9f73de352b
commit 72af4b9598

View file

@ -18,8 +18,8 @@ class MemoriesWidget extends StatefulWidget {
class _MemoriesWidgetState extends State<MemoriesWidget> {
late ScrollController _controller;
late StreamSubscription<MemoriesSettingChanged> _subscription;
double _maxHeight = 0;
double _maxWidth = 0;
late double _maxHeight;
late double _maxWidth;
@override
void initState() {
@ -36,7 +36,8 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
void didChangeDependencies() {
super.didChangeDependencies();
final screenWidth = MediaQuery.sizeOf(context).width;
_maxWidth = screenWidth / 4;
final factor = (screenWidth / 220).ceil();
_maxWidth = screenWidth / (factor * 2);
_maxHeight = _maxWidth / MemoryCoverWidget.aspectRatio;
}