first commit
This commit is contained in:
61
lib/common/widgets/wspace.dart
Normal file
61
lib/common/widgets/wspace.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
|
||||
///
|
||||
/// Разделитель между виджетами
|
||||
///
|
||||
class HSpace extends StatelessWidget {
|
||||
/// Высота разделителя
|
||||
final double height;
|
||||
|
||||
/// Флаг что необходимо использовать [SliverToBoxAdapter]
|
||||
final bool useSliver;
|
||||
|
||||
///
|
||||
/// Разделитель между виджетами
|
||||
///
|
||||
const HSpace(this.height, {super.key}) : useSliver = false;
|
||||
|
||||
const HSpace.sliver(this.height, {super.key}) : useSliver = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget child = SizedBox(height: height.h);
|
||||
|
||||
if (useSliver) {
|
||||
child = SliverToBoxAdapter(child: child);
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Разделитель между виджетами
|
||||
///
|
||||
class WSpace extends StatelessWidget {
|
||||
/// Ширина разделителя
|
||||
final double width;
|
||||
|
||||
/// Флаг что необходимо использовать [SliverToBoxAdapter]
|
||||
final bool useSliver;
|
||||
|
||||
///
|
||||
/// Разделитель между виджетами
|
||||
///
|
||||
const WSpace(this.width, {super.key}) : useSliver = false;
|
||||
|
||||
const WSpace.sliver(this.width, {super.key}) : useSliver = true;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget child = SizedBox(width: width.w);
|
||||
|
||||
if (useSliver) {
|
||||
child = SliverToBoxAdapter(child: child);
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user