From 26f822e83ae7975f4116385be4a0794f6de83382 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Thu, 2 May 2024 22:56:21 +0300 Subject: [PATCH] Some fixes --- lib/main.dart | 18 +++++++++++++----- lib/pages/detail.dart | 30 ++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 39701f1..8c47920 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,7 +35,8 @@ const List> testData = [ "name": "Протеин", "image": "product.png", "price": "150", - "details": "Test details", + "details": + "that name factory say string eaten order harbor easier said tone now floor nest it comfortable such difficulty labor bridge fact market women badly chamber heading forest allow shirt possibly story strip elephant extra even joy lungs than low discussion barn rapidly evidence is stream crew let more sold bag river triangle court slept knowledge flat package research balloon station underline careful market better make curious secret boy poor captured creature harder public tool ring subject charge planet tone scientist piece page stone support bush way feathers summer describe back should said complex song giant his that name factory say string eaten order harbor easier said tone now floor nest it comfortable such difficulty labor bridge fact market women badly chamber heading forest allow shirt possibly story strip elephant extra even joy lungs than low discussion barn rapidly evidence is stream crew let more sold bag river triangle court slept knowledge flat package research balloon station underline careful market better make curious secret boy poor captured creature harder public tool ring subject charge planet tone scientist piece page stone support bush way feathers summer describe back should said complex song giant his that name factory say string eaten order harbor easier said tone now floor nest it comfortable such difficulty labor bridge fact market women badly chamber heading forest allow shirt possibly story strip elephant extra even joy lungs than low discussion barn rapidly evidence is stream crew let more sold bag river triangle court slept knowledge flat package research balloon station underline careful market better make curious secret boy poor captured creature harder public tool ring subject charge planet tone scientist piece page stone support bush way feathers summer describe back should said complex song giant his that name factory say string eaten order harbor easier said tone now floor nest it comfortable such difficulty labor bridge fact market women badly chamber heading forest allow shirt possibly story strip elephant extra even joy lungs than low discussion barn rapidly evidence is stream crew let more sold bag river triangle court slept knowledge flat package research balloon station underline careful market better make curious secret boy poor captured creature harder public tool ring subject charge planet tone scientist piece page stone support bush way feathers summer describe back should said complex song giant his", "id": "34a26e82-7656-5e98-a44a-c2d01d0b1ad1123" }, { @@ -166,7 +167,9 @@ class _MainPageState extends State { ), ), ), - const SizedBox(width: 8), + const Spacer( + flex: 2, + ), ElevatedButton( onPressed: () { Navigator.of(context).push(MaterialPageRoute( @@ -175,7 +178,7 @@ class _MainPageState extends State { }, style: ElevatedButton.styleFrom( padding: const EdgeInsets.all(0), - minimumSize: const Size(40, kMinInteractiveDimension), + minimumSize: const Size(50, kMinInteractiveDimension), backgroundColor: Theme.of(context).primaryColor, shape: const CircleBorder( side: BorderSide( @@ -190,7 +193,9 @@ class _MainPageState extends State { size: 24, ), ), - const SizedBox(width: 8), + const SizedBox( + width: 8, + ), ElevatedButton( onPressed: () { Navigator.of(context).push(MaterialPageRoute( @@ -199,7 +204,7 @@ class _MainPageState extends State { }, style: ElevatedButton.styleFrom( padding: const EdgeInsets.all(0), - minimumSize: const Size(40, kMinInteractiveDimension), + minimumSize: const Size(50, kMinInteractiveDimension), backgroundColor: Theme.of(context).primaryColor, shape: const CircleBorder( side: BorderSide( @@ -214,6 +219,9 @@ class _MainPageState extends State { size: 24, ), ), + const SizedBox( + width: 10, + ) ], ), ), diff --git a/lib/pages/detail.dart b/lib/pages/detail.dart index 9edc86e..7a4598f 100644 --- a/lib/pages/detail.dart +++ b/lib/pages/detail.dart @@ -31,7 +31,6 @@ class _DetailPageState extends State { void initState() { super.initState(); getCart().then((value) { - debugPrint(value.toString()); setState(() { isInCart = value.any((element) => element['id'] == widget.id); if (isInCart) { @@ -109,26 +108,37 @@ class _DetailPageState extends State { height: MediaQuery.sizeOf(context).height, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, children: [ widget.image, Padding( padding: const EdgeInsetsDirectional.fromSTEB(0, 30, 60, 60), - child: SizedBox( - width: 340, - height: MediaQuery.sizeOf(context).height, + child: ConstrainedBox( + constraints: const BoxConstraints( + minWidth: 340, + maxWidth: 340, + maxHeight: 600, + ), child: Card( elevation: 4, color: const Color(0xFFF2F3F9), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20, 15, 10, 15), - child: Text( - widget.description, - style: Theme.of(context).textTheme.bodyMedium, + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20, 15, 10, 15), + child: ConstrainedBox( + constraints: const BoxConstraints( + minHeight: 100, + ), + child: Text( + widget.description, + style: Theme.of(context).textTheme.bodyMedium, + ), + ), ), ), ),