Обновлен проект. Добавлена БД
This commit is contained in:
@@ -0,0 +1,211 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_keyboard_size/flutter_keyboard_size.dart';
|
||||
import 'package:remever/common/functions.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/common/widgets/wspace.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
import 'package:remever/screens/dialogs/alert_dialog.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CrudCollectionFullscreenField extends StatelessWidget {
|
||||
CrudCollectionFullscreenField({
|
||||
super.key,
|
||||
this.title = '',
|
||||
this.hint,
|
||||
this.height = 92,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final double height;
|
||||
final String? hint;
|
||||
|
||||
final TextEditingController _controller = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return KeyboardSizeProvider(
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.gray_bg,
|
||||
appBar: _buildAppBar(context),
|
||||
body: _buildMainBody(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение основного тела экрана
|
||||
Widget _buildMainBody(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const HSpace(16),
|
||||
_buildField(context),
|
||||
if (hint != null) ...<Widget>[
|
||||
const HSpace(16),
|
||||
AppTypography(
|
||||
hint!,
|
||||
type: Regular14px(),
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
_buildMenu(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение интерактивной плашки меню
|
||||
Widget _buildMenu() {
|
||||
return Consumer<ScreenHeight>(
|
||||
builder: (BuildContext context, ScreenHeight res, Widget? child) {
|
||||
return AnimatedOpacity(
|
||||
opacity: res.isOpen ? 1 : 0,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: Container(
|
||||
height: 64.h,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
border: Border(
|
||||
top: BorderSide(color: AppColors.gray, width: 1.w),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
child: Assets.icons.typePaste.image(
|
||||
height: 24.h,
|
||||
width: 24.w,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
child: Assets.icons.typeCopy.image(height: 24.h, width: 24.w),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => context.back(),
|
||||
child: SizedBox.square(
|
||||
dimension: 32.r,
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
child: Center(
|
||||
child: Assets.icons.typeCheck.image(
|
||||
height: 24.h,
|
||||
width: 24.w,
|
||||
color: AppColors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение поля ввода
|
||||
Widget _buildField(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: height.h,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)).r,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12).r,
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: _controller,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
maxLines: 99,
|
||||
cursorColor: AppColors.danger,
|
||||
decoration: const InputDecoration.collapsed(
|
||||
hintText: 'Введите содержимое',
|
||||
hintStyle: TextStyle(color: AppColors.gray),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение шапки
|
||||
AppBar _buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
toolbarHeight: 56.h,
|
||||
backgroundColor: AppColors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
leading: IconButton(
|
||||
onPressed: () async {
|
||||
context.back();
|
||||
},
|
||||
icon: const Icon(CupertinoIcons.left_chevron, color: Colors.black),
|
||||
),
|
||||
centerTitle: true,
|
||||
title: GestureDetector(
|
||||
onLongPress: () async {
|
||||
final bool? res = await showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 262.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
title:
|
||||
'Вы хотите выйти из режима создания описания коллекции?',
|
||||
acceptTitle: 'Выйти, не сохранять',
|
||||
declineTitle: 'Сохранить и выйти',
|
||||
),
|
||||
);
|
||||
|
||||
if (res != null && res) context.back();
|
||||
},
|
||||
child: AppTypography(
|
||||
title,
|
||||
type: SemiBold20px(),
|
||||
color: AppColors.body_text,
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 16).r,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 262.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
title: 'Вы хотите сбросить все внесенные изменения?',
|
||||
acceptTitle: 'Да, сбросить',
|
||||
declineTitle: 'Нет, оставить',
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Assets.icons.typeTrash.image(
|
||||
height: 24.h,
|
||||
width: 24.w,
|
||||
color: AppColors.danger,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user