Code improvements
This commit is contained in:
@@ -14,7 +14,7 @@ class CustomListTile extends StatelessWidget {
|
||||
final Color? color;
|
||||
|
||||
const CustomListTile({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.subtitleWidget,
|
||||
@@ -26,7 +26,7 @@ class CustomListTile extends StatelessWidget {
|
||||
this.disabled,
|
||||
this.onHover,
|
||||
this.color,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -76,20 +76,21 @@ class CustomListTile extends StatelessWidget {
|
||||
Text(
|
||||
subtitle!,
|
||||
style: TextStyle(
|
||||
color: disabled == true
|
||||
? Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.38)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400),
|
||||
color: disabled == true
|
||||
? Theme.of(context).colorScheme.onSurfaceVariant.withOpacity(0.38)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (trailing != null) ...[const SizedBox(width: 16), trailing!]
|
||||
if (trailing != null) ...[const SizedBox(width: 16), trailing!],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -60,18 +60,19 @@ class CustomSettingsTile extends StatelessWidget {
|
||||
Text(
|
||||
subtitle!,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400),
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (trailing != null) ...[const SizedBox(width: 10), trailing!]
|
||||
if (trailing != null) ...[const SizedBox(width: 10), trailing!],
|
||||
],
|
||||
);
|
||||
|
||||
@@ -84,12 +85,14 @@ class CustomSettingsTile extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
color: thisItem == selectedItem ? Theme.of(context).colorScheme.primaryContainer : null),
|
||||
child: tileBody),
|
||||
width: double.maxFinite,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
color: thisItem == selectedItem ? Theme.of(context).colorScheme.primaryContainer : null,
|
||||
),
|
||||
child: tileBody,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -25,13 +25,15 @@ class CustomSwitchListTile extends StatelessWidget {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: disabled != null && disabled == true
|
||||
? null
|
||||
: () => onChanged(!value),
|
||||
onTap: disabled != null && disabled == true ? null : () => onChanged(!value),
|
||||
child: Padding(
|
||||
padding: padding ?? const EdgeInsets.only(
|
||||
top: 12, left: 16, right: 18, bottom: 16
|
||||
),
|
||||
padding: padding ??
|
||||
const EdgeInsets.only(
|
||||
top: 12,
|
||||
left: 16,
|
||||
right: 18,
|
||||
bottom: 16,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -55,35 +57,33 @@ class CustomSwitchListTile extends StatelessWidget {
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ... [
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 5),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width-110,
|
||||
width: MediaQuery.of(context).size.width - 110,
|
||||
child: Text(
|
||||
subtitle!,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: disabled != null && disabled == true
|
||||
? Theme.of(context).listTileTheme.textColor!.withOpacity(0.38)
|
||||
: Theme.of(context).listTileTheme.textColor
|
||||
? Theme.of(context).listTileTheme.textColor!.withOpacity(0.38)
|
||||
: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Switch(
|
||||
value: value,
|
||||
onChanged: disabled != null && disabled == true
|
||||
? null
|
||||
: onChanged,
|
||||
)
|
||||
value: value,
|
||||
onChanged: disabled != null && disabled == true ? null : onChanged,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ class EnterSearchTermScreen extends StatelessWidget {
|
||||
final String message;
|
||||
|
||||
const EnterSearchTermScreen({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.message,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -4,9 +4,9 @@ class ErrorScreen extends StatelessWidget {
|
||||
final String error;
|
||||
|
||||
const ErrorScreen({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.error,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -4,9 +4,9 @@ class NoDataScreen extends StatelessWidget {
|
||||
final String message;
|
||||
|
||||
const NoDataScreen({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.message,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -5,9 +5,9 @@ class PageTransition extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const PageTransition({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -4,9 +4,9 @@ class ProcessDialog extends StatelessWidget {
|
||||
final String message;
|
||||
|
||||
const ProcessDialog({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.message,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -29,7 +29,7 @@ class ProcessDialog extends StatelessWidget {
|
||||
message,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurface),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,10 +5,10 @@ class SectionLabel extends StatelessWidget {
|
||||
final EdgeInsets? padding;
|
||||
|
||||
const SectionLabel({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.label,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||
class SliverTabBody extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const SliverTabBody({Key? key, required this.child}) : super(key: key);
|
||||
const SliverTabBody({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -28,10 +28,10 @@ class SliverTabBodyRefresh extends StatelessWidget {
|
||||
final Future<void> Function() onRefresh;
|
||||
|
||||
const SliverTabBodyRefresh({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.child,
|
||||
required this.onRefresh,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user