From 8c620b0441c9db0b4e15fbebb686b38f882d4580 Mon Sep 17 00:00:00 2001 From: TechAurelian Date: Fri, 18 Oct 2024 20:29:01 +0300 Subject: [PATCH] Try to improve the UI layout --- lib/screens/home_screen.dart | 5 ++++- lib/widgets/rgb_sliders_screen.dart | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index 4c14861..ca518a1 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -19,6 +19,9 @@ class _HomeScreenState extends State { @override Widget build(BuildContext context) { + // Calculate horizontal padding based on the screen width. + final double horizontalPadding = MediaQuery.of(context).size.width * 0.15; + return Scaffold( backgroundColor: _color, appBar: AppBar( @@ -26,7 +29,7 @@ class _HomeScreenState extends State { ), body: Center( child: Padding( - padding: const EdgeInsets.only(left: 32, right: 48), + padding: EdgeInsets.only(left: horizontalPadding - 16, right: horizontalPadding), child: RGBSliders( initialColor: _color, onColorChanged: (Color color) { diff --git a/lib/widgets/rgb_sliders_screen.dart b/lib/widgets/rgb_sliders_screen.dart index 90d4b3f..50d2633 100644 --- a/lib/widgets/rgb_sliders_screen.dart +++ b/lib/widgets/rgb_sliders_screen.dart @@ -156,6 +156,7 @@ class _RGBSlider extends StatelessWidget { value: value.toDouble(), min: 0, max: 255, + divisions: 255, activeColor: foregroundColor, inactiveColor: foregroundColor, thumbColor: rgbColor, @@ -209,7 +210,7 @@ class _RGBTextField extends StatelessWidget { ); return Padding( - padding: const EdgeInsets.symmetric(vertical: 16.0), + padding: const EdgeInsets.symmetric(vertical: 24.0), child: TextField( controller: controller, decoration: InputDecoration(