You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
Dart
45 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
import '../new_views/app_style/app_color.dart';
|
|
|
|
extension WidgetExtensions on Widget {
|
|
Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this, highlightColor: Colors.transparent, splashColor: Colors.transparent);
|
|
|
|
Widget get expanded => Expanded(child: this);
|
|
|
|
Widget get center => Center(child: this);
|
|
|
|
Widget circle(double value) => ClipRRect(borderRadius: BorderRadius.circular(value), child: this);
|
|
|
|
Widget paddingAll(double value) => Padding(padding: EdgeInsets.all(value), child: this);
|
|
|
|
Widget paddingOnly({int start = 0, int end = 0, int top = 0, int bottom = 0}) =>
|
|
Padding(padding: EdgeInsetsDirectional.only(start: start.toScreenWidth, end: end.toScreenWidth, top: top.toScreenHeight, bottom: bottom.toScreenHeight), child: this);
|
|
|
|
Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this);
|
|
|
|
Widget get toShadowContainer => Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: ShapeDecoration(
|
|
color: Colors.white,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
shadows: const [
|
|
BoxShadow(
|
|
color: Color(0x07000000),
|
|
blurRadius: 14,
|
|
offset: Offset(0, 0),
|
|
spreadRadius: 0,
|
|
)
|
|
],
|
|
),
|
|
child: this);
|
|
}
|
|
|
|
extension DividerExtension on Divider {
|
|
Divider defaultStyle(BuildContext context) => Divider(thickness: 1, color: context.isDark ? AppColor.neutral50 : AppColor.neutral30);
|
|
}
|