Replacing SizedBox with Gap

This commit is contained in:
Yoshi 2024-08-04 11:48:25 +03:00
parent 8bce420296
commit 91e1757a20
11 changed files with 46 additions and 28 deletions

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rain/app/controller/controller.dart'; import 'package:rain/app/controller/controller.dart';
import 'package:rain/app/widgets/status/status_weather.dart'; import 'package:rain/app/widgets/status/status_weather.dart';
@ -62,7 +63,7 @@ class _WeatherCardContainerState extends State<WeatherCardContainer> {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
const SizedBox(width: 7), const Gap(7),
Text( Text(
statusWeather.getText(widget.weather[weatherController statusWeather.getText(widget.weather[weatherController
.getTime(widget.time, widget.timezone)]), .getTime(widget.time, widget.timezone)]),
@ -73,7 +74,7 @@ class _WeatherCardContainerState extends State<WeatherCardContainer> {
), ),
], ],
), ),
const SizedBox(height: 10), const Gap(10),
Text( Text(
widget.district.isEmpty widget.district.isEmpty
? widget.city ? widget.city
@ -87,7 +88,7 @@ class _WeatherCardContainerState extends State<WeatherCardContainer> {
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
const SizedBox(height: 5), const Gap(5),
StreamBuilder( StreamBuilder(
stream: Stream.periodic(const Duration(seconds: 1)), stream: Stream.periodic(const Duration(seconds: 1)),
builder: (context, snapshot) { builder: (context, snapshot) {
@ -103,7 +104,7 @@ class _WeatherCardContainerState extends State<WeatherCardContainer> {
], ],
), ),
), ),
const SizedBox(width: 5), const Gap(5),
Image.asset( Image.asset(
statusWeather.getImageNow( statusWeather.getImageNow(
widget.weather[ widget.weather[

View file

@ -1,5 +1,6 @@
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:iconsax/iconsax.dart'; import 'package:iconsax/iconsax.dart';
@ -360,7 +361,7 @@ class _SelectGeolocationState extends State<SelectGeolocation> {
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
left: 10, right: 10, top: 10), left: 10, right: 10, top: 10),
), ),
const SizedBox(height: 20), const Gap(20),
], ],
), ),
), ),

View file

@ -1,3 +1,4 @@
import 'package:gap/gap.dart';
import 'package:rain/app/data/weather.dart'; import 'package:rain/app/data/weather.dart';
import 'package:rain/app/modules/geolocation.dart'; import 'package:rain/app/modules/geolocation.dart';
import 'package:rain/app/widgets/button.dart'; import 'package:rain/app/widgets/button.dart';
@ -166,7 +167,7 @@ class OnboardContent extends StatelessWidget {
style: context.textTheme.titleLarge style: context.textTheme.titleLarge
?.copyWith(fontWeight: FontWeight.w600), ?.copyWith(fontWeight: FontWeight.w600),
), ),
const SizedBox(height: 10), const Gap(10),
SizedBox( SizedBox(
width: 300, width: 300,
child: Text( child: Text(

View file

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hsvcolor_picker/flutter_hsvcolor_picker.dart'; import 'package:flutter_hsvcolor_picker/flutter_hsvcolor_picker.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:gap/gap.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:iconsax/iconsax.dart'; import 'package:iconsax/iconsax.dart';
@ -162,7 +163,7 @@ class _SettingsPageState extends State<SettingsPage> {
setState(() {}); setState(() {});
}, },
), ),
const SizedBox(height: 10), const Gap(10),
], ],
), ),
); );
@ -451,7 +452,7 @@ class _SettingsPageState extends State<SettingsPage> {
} }
}, },
), ),
const SizedBox(height: 10), const Gap(10),
], ],
), ),
); );
@ -602,7 +603,7 @@ class _SettingsPageState extends State<SettingsPage> {
setState(() {}); setState(() {});
}, },
), ),
const SizedBox(height: 10), const Gap(10),
], ],
), ),
); );
@ -819,7 +820,7 @@ class _SettingsPageState extends State<SettingsPage> {
); );
}, },
), ),
const SizedBox(height: 10), const Gap(10),
], ],
), ),
); );
@ -887,7 +888,7 @@ class _SettingsPageState extends State<SettingsPage> {
); );
}, },
), ),
const SizedBox(height: 10), const Gap(10),
], ],
); );
}, },
@ -938,7 +939,7 @@ class _SettingsPageState extends State<SettingsPage> {
onPressed: () => urlLauncher( onPressed: () => urlLauncher(
'https://yoomoney.ru/to/4100117672775961'), 'https://yoomoney.ru/to/4100117672775961'),
), ),
const SizedBox(height: 10), const Gap(10),
], ],
), ),
); );
@ -1002,7 +1003,7 @@ class _SettingsPageState extends State<SettingsPage> {
} }
}, },
), ),
const SizedBox(height: 10), const Gap(10),
], ],
), ),
); );
@ -1064,7 +1065,7 @@ class _SettingsPageState extends State<SettingsPage> {
onTap: () => urlLauncher('https://open-meteo.com/'), onTap: () => urlLauncher('https://open-meteo.com/'),
), ),
), ),
const SizedBox(height: 10), const Gap(10),
], ],
), ),
); );

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:rain/app/widgets/status/status_weather.dart'; import 'package:rain/app/widgets/status/status_weather.dart';
@ -47,7 +48,7 @@ class _ListDailyCardState extends State<ListDailyCard> {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
const SizedBox(height: 5), const Gap(5),
Text( Text(
DateFormat.MMMMEEEEd(locale.languageCode) DateFormat.MMMMEEEEd(locale.languageCode)
.format(widget.timeDaily), .format(widget.timeDaily),
@ -56,7 +57,7 @@ class _ListDailyCardState extends State<ListDailyCard> {
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
), ),
const SizedBox(height: 5), const Gap(5),
Text( Text(
statusWeather.getText(widget.weathercodeDaily), statusWeather.getText(widget.weathercodeDaily),
style: context.textTheme.titleMedium?.copyWith( style: context.textTheme.titleMedium?.copyWith(
@ -67,7 +68,7 @@ class _ListDailyCardState extends State<ListDailyCard> {
], ],
), ),
), ),
const SizedBox(width: 5), const Gap(5),
Image.asset( Image.asset(
statusWeather.getImageNowDaily(widget.weathercodeDaily), statusWeather.getImageNowDaily(widget.weathercodeDaily),
scale: 6.5, scale: 6.5,

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:rain/app/data/weather.dart'; import 'package:rain/app/data/weather.dart';
@ -80,7 +81,7 @@ class _WeatherDailyState extends State<WeatherDaily> {
.getImage7Day(weatherCodeDaily[index]), .getImage7Day(weatherCodeDaily[index]),
scale: 3, scale: 3,
), ),
const SizedBox(width: 5), const Gap(5),
Expanded( Expanded(
child: Text( child: Text(
statusWeather statusWeather

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
class DescWeather extends StatefulWidget { class DescWeather extends StatefulWidget {
@ -38,7 +39,7 @@ class _DescWeatherState extends State<DescWeather> {
widget.imageName, widget.imageName,
scale: 20, scale: 20,
), ),
const SizedBox(height: 5), const Gap(5),
Text( Text(
widget.value, widget.value,
style: textTheme.labelLarge, style: textTheme.labelLarge,

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_glow/flutter_glow.dart'; import 'package:flutter_glow/flutter_glow.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:rain/app/widgets/status/status_data.dart'; import 'package:rain/app/widgets/status/status_data.dart';
@ -43,7 +44,7 @@ class _WeatherNowState extends State<WeatherNow> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const SizedBox(height: 15), const Gap(15),
Image( Image(
image: AssetImage(statusWeather.getImageNow(widget.weather, image: AssetImage(statusWeather.getImageNow(widget.weather,
widget.time, widget.timeDay, widget.timeNight)), widget.time, widget.timeDay, widget.timeNight)),
@ -61,7 +62,7 @@ class _WeatherNowState extends State<WeatherNow> {
statusWeather.getText(widget.weather), statusWeather.getText(widget.weather),
style: context.textTheme.titleLarge, style: context.textTheme.titleLarge,
), ),
const SizedBox(height: 5), const Gap(5),
Text( Text(
DateFormat.MMMMEEEEd(locale.languageCode).format( DateFormat.MMMMEEEEd(locale.languageCode).format(
DateTime.parse(widget.time), DateTime.parse(widget.time),
@ -93,7 +94,7 @@ class _WeatherNowState extends State<WeatherNow> {
color: Colors.grey, color: Colors.grey,
), ),
), ),
const SizedBox(height: 5), const Gap(5),
Text( Text(
statusWeather.getText(widget.weather), statusWeather.getText(widget.weather),
style: context.textTheme.titleLarge style: context.textTheme.titleLarge
@ -109,7 +110,7 @@ class _WeatherNowState extends State<WeatherNow> {
style: context.textTheme.bodyMedium), style: context.textTheme.bodyMedium),
], ],
), ),
const SizedBox(height: 30), const Gap(30),
Text( Text(
statusData.getDegree(roundDegree statusData.getDegree(roundDegree
? widget.degree.round() ? widget.degree.round()
@ -118,7 +119,7 @@ class _WeatherNowState extends State<WeatherNow> {
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
), ),
), ),
const SizedBox(height: 5), const Gap(5),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:gap/gap.dart';
import 'package:rain/app/widgets/status/status_data.dart'; import 'package:rain/app/widgets/status/status_data.dart';
class SunsetSunrise extends StatefulWidget { class SunsetSunrise extends StatefulWidget {
@ -44,7 +45,7 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
style: titleSmall, style: titleSmall,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const SizedBox(height: 2), const Gap(2),
Text( Text(
statusData.getTimeFormat(widget.timeSunrise), statusData.getTimeFormat(widget.timeSunrise),
style: titleLarge, style: titleLarge,
@ -52,7 +53,7 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
], ],
), ),
), ),
const SizedBox(width: 5), const Gap(5),
Flexible( Flexible(
child: Image.asset( child: Image.asset(
'assets/images/sunrise.png', 'assets/images/sunrise.png',
@ -75,7 +76,7 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
style: titleSmall, style: titleSmall,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
const SizedBox(height: 2), const Gap(2),
Text( Text(
statusData.getTimeFormat(widget.timeSunset), statusData.getTimeFormat(widget.timeSunset),
style: titleLarge, style: titleLarge,
@ -83,7 +84,7 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
], ],
), ),
), ),
const SizedBox(width: 5), const Gap(5),
Flexible( Flexible(
child: Image.asset( child: Image.asset(
'assets/images/sunset.png', 'assets/images/sunset.png',

View file

@ -430,6 +430,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
gap:
dependency: "direct main"
description:
name: gap
sha256: f19387d4e32f849394758b91377f9153a1b41d79513ef7668c088c77dbc6955d
url: "https://pub.dev"
source: hosted
version: "3.0.1"
geocoding: geocoding:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -14,6 +14,7 @@ dependencies:
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter
get: ^4.6.6 get: ^4.6.6
gap: ^3.0.1
dio: ^5.5.0+1 dio: ^5.5.0+1
intl: ^0.19.0 intl: ^0.19.0
isar: isar: