first commit
This commit is contained in:
21
lib/widgets/bottom_safe_space.dart
Normal file
21
lib/widgets/bottom_safe_space.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BottomSafeSpace extends StatelessWidget {
|
||||
///
|
||||
/// Отступ от нижней границы экрана
|
||||
///
|
||||
/// Для iOS значение будет не нулевое если есть "полоска"
|
||||
/// Для Android в основном будет 0
|
||||
///
|
||||
const BottomSafeSpace({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).padding.bottom,
|
||||
);
|
||||
}
|
||||
}
|
||||
56
lib/widgets/primary_button.dart
Normal file
56
lib/widgets/primary_button.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/components/extensions/state.dart';
|
||||
|
||||
class PrimaryButton extends StatefulWidget {
|
||||
const PrimaryButton({
|
||||
required this.child,
|
||||
required this.onTap,
|
||||
super.key,
|
||||
this.height = 52,
|
||||
this.width = double.infinity,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final double height;
|
||||
final double width;
|
||||
final Function() onTap;
|
||||
|
||||
@override
|
||||
State<PrimaryButton> createState() => _PrimaryButtonState();
|
||||
}
|
||||
|
||||
class _PrimaryButtonState extends State<PrimaryButton> {
|
||||
bool isLoading = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
safeSetState(() => isLoading = !isLoading);
|
||||
await widget.onTap();
|
||||
safeSetState(() => isLoading = !isLoading);
|
||||
},
|
||||
child: SizedBox(
|
||||
height: widget.height.h,
|
||||
width: widget.width,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)).r,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
child: Center(
|
||||
child:
|
||||
isLoading
|
||||
? const CircularProgressIndicator(
|
||||
color: AppColors.bg,
|
||||
backgroundColor: Colors.transparent,
|
||||
)
|
||||
: widget.child,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user