Обновлен проект. Добавлена БД
This commit is contained in:
@@ -39,7 +39,10 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
Future<void> sendCode(String code, String uid) async {
|
||||
final bool res = await _authInterface.sendCode(code, uid);
|
||||
|
||||
if (!res) toInitialState();
|
||||
if (!res) {
|
||||
toInitialState();
|
||||
return;
|
||||
}
|
||||
|
||||
globalRouter.replace(CollectionRoute());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class AuthTextField extends StatelessWidget {
|
||||
focusedErrorBorder: border,
|
||||
hintText: 'Введите e-mail',
|
||||
hintStyle: const TextStyle(fontWeight: FontWeight.w400, height: 1.2),
|
||||
errorStyle: SemiBold12px().style.copyWith(color: AppColors.red),
|
||||
errorStyle: SemiBold12px().style.copyWith(color: AppColors.info_red),
|
||||
suffixIconConstraints: const BoxConstraints(minWidth: 0, minHeight: 0),
|
||||
suffixIcon: Padding(
|
||||
padding: const EdgeInsets.only(right: 12).r,
|
||||
|
||||
186
lib/screens/collections/collection_detail_screen.dart
Normal file
186
lib/screens/collections/collection_detail_screen.dart
Normal file
@@ -0,0 +1,186 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.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/collections/widgets/learning_card.dart';
|
||||
import 'package:remever/screens/dialogs/info_dialog.dart';
|
||||
import 'package:remever/widgets/primary_button.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CollectionDetailScreen extends StatelessWidget {
|
||||
const CollectionDetailScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.gray_bg,
|
||||
appBar: _buildAppBar(context),
|
||||
body: _buildMain(context),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение шапки
|
||||
AppBar _buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
toolbarHeight: 56.h,
|
||||
backgroundColor: AppColors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
leading: IconButton(
|
||||
onPressed: () async {
|
||||
// context.read<HomeCubit>().toCollection();
|
||||
context.back();
|
||||
},
|
||||
icon: const Icon(CupertinoIcons.left_chevron, color: Colors.black),
|
||||
),
|
||||
centerTitle: false,
|
||||
title: _buildTitle(),
|
||||
actions: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showCupertinoModalBottomSheet(
|
||||
topRadius: const Radius.circular(24).r,
|
||||
backgroundColor: AppColors.white,
|
||||
context: context,
|
||||
builder: (BuildContext _) => const InfoDialog(),
|
||||
);
|
||||
},
|
||||
child: Assets.icons.typeDescription.image(height: 24.h, width: 24.w),
|
||||
),
|
||||
const WSpace(16),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTitle() {
|
||||
return Row(
|
||||
children: <Widget>[_buildAvatar(), const WSpace(5), _buildInfo()],
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение основной информации
|
||||
///
|
||||
Widget _buildInfo() {
|
||||
return Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
_buildCollectionTitle(),
|
||||
const HSpace(4),
|
||||
_buildCards(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение кол-ва карточек и лайков
|
||||
///
|
||||
Widget _buildCards() {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Assets.icons.typeCards.image(
|
||||
height: 18.h,
|
||||
width: 18.w,
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
const WSpace(2),
|
||||
AppTypography(
|
||||
0.toString(),
|
||||
type: Regular14px(),
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
],
|
||||
),
|
||||
const WSpace(8),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Название коллекции
|
||||
///
|
||||
Widget _buildCollectionTitle() {
|
||||
return AppTypography(
|
||||
'Астрономия и тайная комната Харли Хоттера',
|
||||
type: Medium16px(),
|
||||
maxLines: 1,
|
||||
softWrap: true,
|
||||
color: AppColors.primary,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Обложка коллекции
|
||||
///
|
||||
Widget _buildAvatar() {
|
||||
return SizedBox.square(
|
||||
dimension: 40.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(image: Assets.images.img.provider()),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение основного содержимого
|
||||
///
|
||||
Widget _buildMain(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
|
||||
child: _buildList(context),
|
||||
);
|
||||
}
|
||||
|
||||
/// Состояние пустого списка
|
||||
Widget _buildEmptyList(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
const HSpace(40),
|
||||
Center(child: Assets.images.noData.image(width: 184.w, height: 101.h)),
|
||||
const Spacer(),
|
||||
_buildCreateBtn(context),
|
||||
const HSpace(40),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
///Кнопка создания
|
||||
Widget _buildCreateBtn(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
height: 52,
|
||||
onTap: () {
|
||||
// context.read<HomeCubit>().toCollection();
|
||||
context.back();
|
||||
},
|
||||
color: AppColors.primary,
|
||||
child: AppTypography('Создать карточку', type: Regular14px()),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение списка карточек
|
||||
///
|
||||
Widget _buildList(BuildContext context) {
|
||||
return ListView.builder(
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemCount: 10,
|
||||
itemBuilder:
|
||||
(BuildContext context, int index) => LearningCard(index: index),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it_mixin/get_it_mixin.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/components/notifiers/home_screen_data.dart';
|
||||
import 'package:remever/database/database.dart';
|
||||
import 'package:remever/database/tables.dart';
|
||||
import 'package:remever/inject.dart';
|
||||
import 'package:remever/router.gr.dart';
|
||||
import 'package:remever/screens/collections/cubit/collection_cubit.dart';
|
||||
import 'package:remever/screens/collections/widgets/collection_card.dart';
|
||||
import 'package:remever/screens/collections/widgets/collections_app_bar.dart';
|
||||
import 'package:remever/screens/collections/widgets/collections_filters.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CollectionScreen extends StatelessWidget with GetItMixin {
|
||||
@@ -20,10 +28,9 @@ class CollectionScreen extends StatelessWidget with GetItMixin {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<CollectionCubit>(
|
||||
create: (context) => CollectionCubit(),
|
||||
|
||||
child: Scaffold(
|
||||
backgroundColor: AppColors.bg,
|
||||
// appBar: const CollectionsAppBar(),
|
||||
appBar: const CollectionsAppBar(),
|
||||
body: _buildMain(context),
|
||||
floatingActionButton: Builder(
|
||||
builder: (BuildContext context) {
|
||||
@@ -32,7 +39,9 @@ class CollectionScreen extends StatelessWidget with GetItMixin {
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: FloatingActionButton(
|
||||
backgroundColor: AppColors.primary,
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
context.pushRoute(CrudCollectionRoute());
|
||||
},
|
||||
// context.read<HomeCubit>().toCrudCollection(CrudType.CREATE),
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
@@ -49,17 +58,16 @@ class CollectionScreen extends StatelessWidget with GetItMixin {
|
||||
Widget _buildMain(BuildContext context) {
|
||||
return BlocBuilder<CollectionCubit, CollectionState>(
|
||||
builder: (context, state) {
|
||||
return state.when(
|
||||
loading: () => _LoadingList(),
|
||||
data:
|
||||
() => const Column(
|
||||
children: <Widget>[
|
||||
// CollectionsFilters(),
|
||||
_CollectionList(),
|
||||
],
|
||||
),
|
||||
empty: () => _EmptyList(),
|
||||
error: () => _ErrorList(),
|
||||
return Column(
|
||||
children: [
|
||||
CollectionsFilters(),
|
||||
state.when(
|
||||
loading: () => _LoadingList(),
|
||||
data: () => _CollectionList(),
|
||||
empty: () => _EmptyList(),
|
||||
error: () => _ErrorList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -71,7 +79,10 @@ class _LoadingList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder(color: Colors.green);
|
||||
return SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height / 2,
|
||||
child: Center(child: CircularProgressIndicator(color: AppColors.primary)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +91,12 @@ class _ErrorList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder(color: Colors.brown);
|
||||
return SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height / 2,
|
||||
child: Center(
|
||||
child: AppTypography('Произошла ошибка при загрузке данных'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +105,10 @@ class _EmptyList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder(color: Colors.red);
|
||||
return SizedBox(
|
||||
height: MediaQuery.sizeOf(context).height / 2,
|
||||
child: Center(child: AppTypography('Нет доступных коллекций')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,15 +123,41 @@ class _CollectionList extends StatelessWidget {
|
||||
collectionCubit.initScrollListener();
|
||||
|
||||
return Expanded(
|
||||
child: ListView.builder(
|
||||
controller: collectionCubit.collectionController,
|
||||
itemCount: 20,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
itemBuilder:
|
||||
(BuildContext context, int index) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8).r,
|
||||
// child: const CollectionCard(),
|
||||
),
|
||||
child: StreamBuilder(
|
||||
stream: getIt<AppDatabase>().collectionsDao.getCollections(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(color: AppColors.primary),
|
||||
);
|
||||
}
|
||||
|
||||
if (snapshot.connectionState == ConnectionState.active ||
|
||||
snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
return _ErrorList();
|
||||
}
|
||||
|
||||
if (snapshot.data == null || snapshot.data!.isEmpty) {
|
||||
return _EmptyList();
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
controller: collectionCubit.collectionController,
|
||||
itemCount: snapshot.data!.length,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
itemBuilder:
|
||||
(BuildContext context, int index) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8).r,
|
||||
child: const CollectionCard(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Center(
|
||||
child: CircularProgressIndicator(color: AppColors.primary),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@ import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:remever/components/notifiers/home_screen_data.dart';
|
||||
import 'package:remever/database/database.dart';
|
||||
import 'package:remever/inject.dart';
|
||||
|
||||
part 'collection_state.dart';
|
||||
part 'collection_cubit.freezed.dart';
|
||||
|
||||
class CollectionCubit extends Cubit<CollectionState> {
|
||||
CollectionCubit() : super(CollectionState.loading());
|
||||
CollectionCubit() : super(CollectionState.data());
|
||||
|
||||
/// Нотифаер домашнего экрана
|
||||
CollectionData get _cd => getIt<CollectionData>();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
part of 'collection_cubit.dart';
|
||||
|
||||
@freezed
|
||||
class CollectionState with _$CollectionState {
|
||||
sealed class CollectionState with _$CollectionState {
|
||||
const factory CollectionState.loading() = _Loading;
|
||||
const factory CollectionState.data() = _Data;
|
||||
const factory CollectionState.empty() = _Empty;
|
||||
|
||||
190
lib/screens/collections/widgets/collection_card.dart
Normal file
190
lib/screens/collections/widgets/collection_card.dart
Normal file
@@ -0,0 +1,190 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.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/router.gr.dart';
|
||||
import 'package:remever/screens/collections/widgets/collection_progress_bar.dart';
|
||||
import 'package:remever/screens/dialogs/action_dialog.dart';
|
||||
|
||||
class CollectionCard extends StatelessWidget {
|
||||
const CollectionCard({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Slidable(
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.62,
|
||||
motion: const StretchMotion(),
|
||||
children: <Widget>[
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: const Color(0xFFD7E6F4),
|
||||
foregroundColor: const Color(0xFF0058AB),
|
||||
icon: Icons.info_outline,
|
||||
onPressed: () {},
|
||||
),
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: const Color(0xFFFFE4E6),
|
||||
foregroundColor: const Color(0xFFFF5C69),
|
||||
icon: Icons.favorite_border,
|
||||
onPressed: () {},
|
||||
),
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: AppColors.secondary,
|
||||
foregroundColor: AppColors.primary,
|
||||
icon: Icons.visibility_off_outlined,
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: () => context.pushRoute(CollectionDetailRoute()),
|
||||
child: Container(
|
||||
constraints: BoxConstraints(minHeight: 66.h, maxHeight: 84.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
color: AppColors.white,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8).r,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
_buildAvatar(),
|
||||
const WSpace(5),
|
||||
_buildInfo(),
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 477.h,
|
||||
builder: (BuildContext context) => const ActionDialog(),
|
||||
);
|
||||
},
|
||||
child: Assets.icons.typeMenuVertical.image(
|
||||
height: 24.h,
|
||||
width: 24.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение основной информации
|
||||
///
|
||||
Widget _buildInfo() {
|
||||
return SizedBox(
|
||||
width: 230.w,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
_buildTitle(),
|
||||
const HSpace(4),
|
||||
_buildLikeAndCardsLength(),
|
||||
const HSpace(6),
|
||||
const CollectionProgressBar(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение кол-ва карточек и лайков
|
||||
///
|
||||
Widget _buildLikeAndCardsLength() {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
_buildIconWithText(
|
||||
icon: Assets.icons.typeCards,
|
||||
color: AppColors.disabled,
|
||||
text: Random().nextInt(654).toString(),
|
||||
),
|
||||
const WSpace(8),
|
||||
_buildIconWithText(
|
||||
icon: Assets.icons.typeLike1818,
|
||||
color: AppColors.danger,
|
||||
text: Random().nextInt(7689).toString(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Название коллекции
|
||||
///
|
||||
Widget _buildTitle() {
|
||||
return AppTypography(
|
||||
'Астрономия',
|
||||
type: Medium16px(),
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Обложка коллекции
|
||||
///
|
||||
Widget _buildAvatar() {
|
||||
return SizedBox.square(
|
||||
dimension: 50.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(image: Assets.images.img.provider()),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Кнопка в меню свайпа
|
||||
///
|
||||
Widget _buildSlidableAction({
|
||||
required BuildContext context,
|
||||
required Color backgroundColor,
|
||||
required Color foregroundColor,
|
||||
required IconData icon,
|
||||
required VoidCallback onPressed,
|
||||
}) {
|
||||
return SlidableAction(
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
onPressed: (_) => onPressed(),
|
||||
backgroundColor: backgroundColor,
|
||||
foregroundColor: foregroundColor,
|
||||
icon: icon,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение инфо
|
||||
///
|
||||
Widget _buildIconWithText({
|
||||
required AssetGenImage icon,
|
||||
required Color color,
|
||||
required String text,
|
||||
}) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
icon.image(height: 18.h, width: 18.w, color: color),
|
||||
const WSpace(2),
|
||||
AppTypography(text, type: Regular14px(), color: color),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
39
lib/screens/collections/widgets/collection_progress_bar.dart
Normal file
39
lib/screens/collections/widgets/collection_progress_bar.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
|
||||
class CollectionProgressBar extends StatelessWidget {
|
||||
const CollectionProgressBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 2.h,
|
||||
width: 230.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(2)).r,
|
||||
color: AppColors.gray,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 2.h,
|
||||
width: Random().nextInt(230).w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(2)).r,
|
||||
gradient: const LinearGradient(
|
||||
colors: <Color>[
|
||||
Color(0xFFA7DEDC),
|
||||
Color(0xFF318D89),
|
||||
Color(0xFF4633BF),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.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/router.gr.dart';
|
||||
import 'package:remever/screens/dialogs/filters_dialog.dart';
|
||||
|
||||
class CollectionsAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const CollectionsAppBar({super.key});
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size.fromHeight(66.h);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
toolbarHeight: 66.h,
|
||||
backgroundColor: AppColors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
title: Row(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onLongPress: () => context.pushRoute(const SandboxRoute()),
|
||||
child: AppTypography(
|
||||
'Коллекции',
|
||||
type: SemiBold28px(),
|
||||
color: AppColors.body_text,
|
||||
),
|
||||
),
|
||||
const WSpace(2),
|
||||
Container(
|
||||
height: 22.h,
|
||||
width: 38.w,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.secondary,
|
||||
borderRadius: BorderRadius.circular(40).r,
|
||||
),
|
||||
child: Center(
|
||||
child: AppTypography(
|
||||
'2213',
|
||||
type: Regular12px(),
|
||||
color: AppColors.body_text,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
AppBarIconButton(icon: Assets.icons.typeSearch, onTap: () {}),
|
||||
AppBarIconButton(icon: Assets.icons.typeDownload, onTap: () {}),
|
||||
AppBarIconButton(
|
||||
icon: Assets.icons.typeSort,
|
||||
onTap: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 424.h,
|
||||
builder: (BuildContext context) => const FiltersDialog(),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppBarIconButton extends StatelessWidget {
|
||||
const AppBarIconButton({required this.icon, required this.onTap, super.key});
|
||||
|
||||
final AssetGenImage icon;
|
||||
final void Function()? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: 48.h,
|
||||
child: Center(child: icon.image(height: 24.h, width: 24.w)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
import 'package:remever/router.gr.dart';
|
||||
import 'package:remever/screens/dialogs/filters_dialog.dart';
|
||||
import 'package:remever/screens/home/home_screen.dart';
|
||||
|
||||
class CollectionsAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const CollectionsAppBar({super.key});
|
||||
@@ -22,10 +21,12 @@ class CollectionsAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
toolbarHeight: 66.h,
|
||||
backgroundColor: AppColors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
// leading: SizedBox(),
|
||||
leadingWidth: 0,
|
||||
title: Row(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
// onLongPress: () => context.pushRoute(const SandboxRoute()),
|
||||
onLongPress: () => context.pushRoute(const SandboxRoute()),
|
||||
child: AppTypography(
|
||||
'Коллекции',
|
||||
type: SemiBold28px(),
|
||||
|
||||
76
lib/screens/collections/widgets/collections_filters.dart
Normal file
76
lib/screens/collections/widgets/collections_filters.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/components/extensions/state.dart';
|
||||
import 'package:remever/screens/collections/cubit/collection_cubit.dart';
|
||||
|
||||
class CollectionsFilters extends StatefulWidget {
|
||||
const CollectionsFilters({super.key});
|
||||
|
||||
@override
|
||||
State<CollectionsFilters> createState() => _CollectionsFiltersState();
|
||||
}
|
||||
|
||||
class _CollectionsFiltersState extends State<CollectionsFilters> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 28).r,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
_buildFilterButton(
|
||||
context.read<CollectionCubit>().collectionFiltersIndex == 0
|
||||
? AppColors.white
|
||||
: AppColors.gray_bg,
|
||||
'Все',
|
||||
() {
|
||||
context.read<CollectionCubit>().collectionFiltersIndex = 0;
|
||||
safeSetState(() {});
|
||||
},
|
||||
),
|
||||
_buildFilterButton(
|
||||
context.read<CollectionCubit>().collectionFiltersIndex == 1
|
||||
? AppColors.white
|
||||
: AppColors.gray_bg,
|
||||
'Публичные',
|
||||
() {
|
||||
context.read<CollectionCubit>().collectionFiltersIndex = 1;
|
||||
safeSetState(() {});
|
||||
},
|
||||
),
|
||||
_buildFilterButton(
|
||||
context.read<CollectionCubit>().collectionFiltersIndex == 2
|
||||
? AppColors.white
|
||||
: AppColors.gray_bg,
|
||||
'Подписки',
|
||||
() {
|
||||
context.read<CollectionCubit>().collectionFiltersIndex = 2;
|
||||
safeSetState(() {});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение кнопки фильтра
|
||||
///
|
||||
Widget _buildFilterButton(Color color, String title, void Function()? onTap) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: 103.h,
|
||||
height: 36.h,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)).r,
|
||||
color: color,
|
||||
),
|
||||
child: Center(child: AppTypography(title, type: SemiBold14px())),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
249
lib/screens/collections/widgets/learning_card.dart
Normal file
249
lib/screens/collections/widgets/learning_card.dart
Normal file
@@ -0,0 +1,249 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:readmore/readmore.dart';
|
||||
import 'package:remever/common/functions.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/typography.dart';
|
||||
import 'package:remever/common/widgets/w_if.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';
|
||||
import 'package:remever/screens/dialogs/replace_diaog.dart';
|
||||
|
||||
enum CardType { CREATE, SHOW }
|
||||
|
||||
class LearningCard extends StatelessWidget {
|
||||
LearningCard({
|
||||
required this.index,
|
||||
super.key,
|
||||
this.type = CardType.SHOW,
|
||||
this.onTextTap,
|
||||
});
|
||||
|
||||
final int index;
|
||||
final CardType type;
|
||||
void Function()? onTextTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8).r,
|
||||
child: Slidable(
|
||||
enabled: type == CardType.SHOW ? true : false,
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.62,
|
||||
motion: const StretchMotion(),
|
||||
children: <Widget>[
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: const Color(0xFFFFE4E6),
|
||||
foregroundColor: const Color(0xFFFF5C69),
|
||||
icon: CupertinoIcons.trash,
|
||||
onPressed: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 262.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
title:
|
||||
'Вы хотите удалить карточку?\nЭто действие необратимо',
|
||||
acceptTitle: 'Да, удалить',
|
||||
declineTitle: 'Нет, оставить',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: const Color(0xFFD7E6F4),
|
||||
foregroundColor: const Color(0xFF0058AB),
|
||||
icon: CupertinoIcons.repeat,
|
||||
onPressed: () {},
|
||||
),
|
||||
const WSpace(8),
|
||||
_buildSlidableAction(
|
||||
context: context,
|
||||
backgroundColor: AppColors.secondary,
|
||||
foregroundColor: AppColors.primary,
|
||||
icon: CupertinoIcons.move,
|
||||
onPressed: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 394.h,
|
||||
backgroundColor: AppColors.gray_bg,
|
||||
builder: (BuildContext context) => const ReplaceDialog(),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)).r,
|
||||
color: Colors.white,
|
||||
),
|
||||
constraints: BoxConstraints(minHeight: 50.h),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
width: double.infinity,
|
||||
child: DecoratedBox(decoration: getDecoration()),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(12).r,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
_buildImage(),
|
||||
_buildText(context),
|
||||
Wif(
|
||||
condition: type == CardType.SHOW,
|
||||
builder: (BuildContext context) => _editBtm(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Кнопка редактирования
|
||||
Widget _editBtm() {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Assets.icons.typeEdit.image(height: 24.h, width: 24.w),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Кнопка в меню свайпа
|
||||
///
|
||||
Widget _buildSlidableAction({
|
||||
required BuildContext context,
|
||||
required Color backgroundColor,
|
||||
required Color foregroundColor,
|
||||
required IconData icon,
|
||||
required VoidCallback onPressed,
|
||||
}) {
|
||||
return SlidableAction(
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
onPressed: (_) => onPressed(),
|
||||
backgroundColor: backgroundColor,
|
||||
foregroundColor: foregroundColor,
|
||||
icon: icon,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildText(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTextTap,
|
||||
child: SizedBox(
|
||||
width:
|
||||
type == CardType.CREATE
|
||||
? 250.w
|
||||
: index % 4 == 0
|
||||
? 228.w
|
||||
: 300.w,
|
||||
child: ReadMoreText(
|
||||
isExpandable: true,
|
||||
index % 2 == 0
|
||||
? 'Наше дело не так однозначно, как может показаться: высокотехнологичная концепция общественного уклада напрямую зависит от вывода текущих активов. Ясность нашей позиции очевидна: высокотехнологичная концепция общественного уклада влечет за собой процесс внедрения и модернизации первоочередных требований. Лишь многие известные личности будут указаны как претенденты на роль ключевых факторов.'
|
||||
: 'Аргумент или не аргумент, вот вообще хз',
|
||||
trimMode: TrimMode.Line,
|
||||
trimLines: 3,
|
||||
trimCollapsedText: '\nРазвернуть',
|
||||
trimExpandedText: '\nСвернуть',
|
||||
style: Regular16px().style,
|
||||
moreStyle: Regular12px().style.copyWith(
|
||||
color: AppColors.primary_blue,
|
||||
),
|
||||
lessStyle: Regular12px().style.copyWith(
|
||||
color: AppColors.primary_blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Картинка
|
||||
Widget _buildImage() {
|
||||
return Wif(
|
||||
condition: type == CardType.SHOW,
|
||||
builder: (BuildContext context) {
|
||||
return Wif(
|
||||
condition: index % 4 == 0,
|
||||
builder: (BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8).r,
|
||||
child: SizedBox.square(
|
||||
dimension: 64.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)).r,
|
||||
image: DecorationImage(
|
||||
image: Assets.images.imgCard.provider(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
fallback: (BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8).r,
|
||||
child: SizedBox.square(
|
||||
dimension: 64.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)).r,
|
||||
gradient: const LinearGradient(
|
||||
colors: <Color>[Color(0xFFDBD7F4), Color(0xFFB6AAFE)],
|
||||
begin: Alignment.topRight,
|
||||
end: Alignment.bottomLeft,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Assets.icons.typePhoto.image(
|
||||
height: 24.h,
|
||||
width: 24.w,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Декорирование контейнера
|
||||
BoxDecoration getDecoration() {
|
||||
return BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)).r,
|
||||
gradient: LinearGradient(
|
||||
colors: <Color>[
|
||||
index % 3 == 0 ? AppColors.question : AppColors.answer,
|
||||
Colors.white,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: const Alignment(-0.6, 1),
|
||||
stops: const <double>[0.25, 0.25],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
252
lib/screens/create_card/create_screen.dart
Normal file
252
lib/screens/create_card/create_screen.dart
Normal file
@@ -0,0 +1,252 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.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/router.gr.dart';
|
||||
import 'package:remever/screens/collections/widgets/collection_progress_bar.dart';
|
||||
import 'package:remever/screens/collections/widgets/learning_card.dart';
|
||||
import 'package:remever/widgets/primary_button.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CreateScreen extends StatelessWidget {
|
||||
const CreateScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.gray_bg,
|
||||
appBar: _buildAppBar(),
|
||||
body: _buildMain(context),
|
||||
);
|
||||
}
|
||||
|
||||
AppBar _buildAppBar() {
|
||||
return AppBar(
|
||||
toolbarHeight: 66.h,
|
||||
backgroundColor: AppColors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
title: AppTypography(
|
||||
'Создать карточку',
|
||||
type: SemiBold20px(),
|
||||
color: AppColors.body_text,
|
||||
),
|
||||
centerTitle: true,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMain(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const HSpace(16),
|
||||
_filters(),
|
||||
const HSpace(16),
|
||||
AppTypography('Коллекция', type: Medium16px()),
|
||||
const HSpace(4),
|
||||
_buildCollection(context),
|
||||
const HSpace(16),
|
||||
AppTypography('Вопрос', type: Medium16px()),
|
||||
const HSpace(4),
|
||||
LearningCard(
|
||||
index: 0,
|
||||
type: CardType.CREATE,
|
||||
onTextTap: () {
|
||||
context.pushRoute(
|
||||
CrudCollectionFullscreenField(
|
||||
title: 'Вопрос',
|
||||
hint: '',
|
||||
height: 313,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const HSpace(16),
|
||||
AppTypography('Ответ', type: Medium16px()),
|
||||
LearningCard(
|
||||
index: 1,
|
||||
type: CardType.CREATE,
|
||||
onTextTap: () {
|
||||
context.pushRoute(
|
||||
CrudCollectionFullscreenField(
|
||||
title: 'Ответ',
|
||||
hint: '',
|
||||
height: 313,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
revertCard(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
_createBtn(),
|
||||
const HSpace(31),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget revertCard() {
|
||||
return SizedBox(
|
||||
height: 52.h,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: Assets.icons.typeFlip2.image(height: 20.h, width: 20.w),
|
||||
),
|
||||
const WSpace(2),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
child: AppTypography(
|
||||
'Создать карточку-наоборот',
|
||||
type: Medium16px(),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
width: 36.w,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: CupertinoSwitch(
|
||||
activeTrackColor: AppColors.primary,
|
||||
value: false,
|
||||
onChanged: (bool value) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Row _filters() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
_buildFilterButton(AppColors.gray_bg, 'Запомнить', () {}),
|
||||
_buildFilterButton(AppColors.white, 'Держать в фокусе', () {}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _createBtn() {
|
||||
return PrimaryButton(
|
||||
color: AppColors.primary,
|
||||
child: AppTypography(
|
||||
'Создать карточку',
|
||||
type: Medium14px(),
|
||||
color: AppColors.white,
|
||||
),
|
||||
onTap: () {},
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение кнопки фильтра
|
||||
///
|
||||
Widget _buildFilterButton(Color color, String title, void Function()? onTap) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: 158.h,
|
||||
height: 36.h,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)).r,
|
||||
color: color,
|
||||
),
|
||||
child: Center(child: AppTypography(title, type: SemiBold14px())),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCollection(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
constraints: BoxConstraints(minHeight: 66.h, maxHeight: 84.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
color: AppColors.white,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8).r,
|
||||
child: Row(
|
||||
children: <Widget>[_buildAvatar(), const WSpace(5), _buildInfo()],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение основной информации
|
||||
///
|
||||
Widget _buildInfo() {
|
||||
return SizedBox(
|
||||
width: 230.w,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
_buildTitle(),
|
||||
const HSpace(4),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Assets.icons.typeCards.image(
|
||||
height: 18.h,
|
||||
width: 18.w,
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
const WSpace(2),
|
||||
AppTypography(
|
||||
Random().nextInt(654).toString(),
|
||||
type: Regular14px(),
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
],
|
||||
),
|
||||
const HSpace(6),
|
||||
const CollectionProgressBar(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Название коллекции
|
||||
///
|
||||
Widget _buildTitle() {
|
||||
return AppTypography(
|
||||
'Астрономия',
|
||||
type: Medium16px(),
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Обложка коллекции
|
||||
///
|
||||
Widget _buildAvatar() {
|
||||
return SizedBox.square(
|
||||
dimension: 50.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(image: Assets.images.img.provider()),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,377 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remever/common/functions.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/toast.dart';
|
||||
import 'package:remever/common/widgets/bottom_safe_space.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/common/widgets/w_if.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/router.gr.dart';
|
||||
import 'package:remever/screens/crud_collection/widgets/crud_collection_field.dart';
|
||||
import 'package:remever/screens/dialogs/alert_dialog.dart';
|
||||
import 'package:remever/screens/dialogs/tags_dialog.dart';
|
||||
import 'package:remever/widgets/primary_button.dart';
|
||||
|
||||
import '../../../components/extensions/state.dart';
|
||||
|
||||
enum CrudType { CREATE, EDIT }
|
||||
|
||||
@RoutePage()
|
||||
class CrudCollection extends StatelessWidget {
|
||||
const CrudCollection({super.key});
|
||||
class CrudCollectionScreen extends StatefulWidget {
|
||||
const CrudCollectionScreen({super.key, this.crudType = CrudType.CREATE});
|
||||
|
||||
final CrudType crudType;
|
||||
|
||||
@override
|
||||
State<CrudCollectionScreen> createState() => _CrudCollectionScreenState();
|
||||
}
|
||||
|
||||
class _CrudCollectionScreenState extends State<CrudCollectionScreen> {
|
||||
/// Флаг публичности коллекции
|
||||
bool _isPublic = false;
|
||||
|
||||
/// Смена публичности
|
||||
void _setPublic(bool public) {
|
||||
safeSetState(() => _isPublic = public);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder(color: Colors.blue);
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.gray_bg,
|
||||
appBar: _buildAppBar(context),
|
||||
body: _buildMainBody(context),
|
||||
);
|
||||
}
|
||||
|
||||
/// Основное тело экрана
|
||||
Widget _buildMainBody(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const HSpace(16),
|
||||
_buildPhotoAndTitle(context),
|
||||
const HSpace(16),
|
||||
..._buildDescription(context),
|
||||
const HSpace(16),
|
||||
_buildPublickSwitch(),
|
||||
const HSpace(16),
|
||||
AnimatedOpacity(
|
||||
opacity: _isPublic ? 1 : 0,
|
||||
duration: const Duration(seconds: 1),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
..._buildTagButton(),
|
||||
const HSpace(16),
|
||||
_buildTagsList(),
|
||||
const HSpace(47),
|
||||
],
|
||||
),
|
||||
),
|
||||
_buildCreateBtn(context),
|
||||
const BottomSafeSpace(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///Кнопка создания
|
||||
Widget _buildCreateBtn(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
height: 52,
|
||||
onTap: () {
|
||||
if (true) {
|
||||
Toast.showDismissible(
|
||||
'Для создания публичной коллекции добавьте описание и тэги',
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// context.read<HomeCubit>().toCollection();
|
||||
},
|
||||
color: AppColors.primary,
|
||||
child: AppTypography(
|
||||
widget.crudType == CrudType.CREATE
|
||||
? 'Создать коллекцию'
|
||||
: 'Сохранить изменения',
|
||||
type: Regular14px(),
|
||||
color: Colors.white,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение списка тегов
|
||||
Widget _buildTagsList() {
|
||||
return SizedBox(
|
||||
height: 68.h,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Wrap(
|
||||
runSpacing: 8.r,
|
||||
spacing: 8.r,
|
||||
children: List<Widget>.generate(6, (int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(6)).r,
|
||||
color: const Color(0xFFFFE4E6),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
AppTypography(
|
||||
'tag $index',
|
||||
type: Regular14px(),
|
||||
height: 0.95,
|
||||
color: AppColors.danger,
|
||||
),
|
||||
const WSpace(8),
|
||||
Center(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 14.r,
|
||||
color: AppColors.danger,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
const WSpace(9),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 270.h,
|
||||
builder: (BuildContext context) => const TagsDialog(),
|
||||
);
|
||||
},
|
||||
child: AppTypography(
|
||||
'+13',
|
||||
type: Medium16px(),
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение кнопки добавления тега
|
||||
List<Widget> _buildTagButton() {
|
||||
return <Widget>[
|
||||
AppTypography('Тэги', type: SemiBold14px()),
|
||||
const HSpace(4),
|
||||
CrudCollectionField(
|
||||
height: 42,
|
||||
width: 348,
|
||||
hint: 'Добавить тэг',
|
||||
// onTap: () => context.pushRoute(const AddTagsRoute()),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// Построение свитчера на публичность коллекции
|
||||
Widget _buildPublickSwitch() {
|
||||
return GestureDetector(
|
||||
onTap: () => _setPublic(!_isPublic),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox.square(
|
||||
dimension: 20.r,
|
||||
child: Assets.icons.typePublic.image(color: AppColors.primary),
|
||||
),
|
||||
const WSpace(2),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
child: AppTypography(
|
||||
'Публичная коллекция',
|
||||
type: Medium16px(),
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
const WSpace(2),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
width: 36.w,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: CupertinoSwitch(
|
||||
activeTrackColor: AppColors.primary,
|
||||
value: _isPublic,
|
||||
onChanged: _setPublic,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение блока с описанием
|
||||
List<Widget> _buildDescription(BuildContext context) {
|
||||
return <Widget>[
|
||||
AppTypography('Описание', type: SemiBold14px()),
|
||||
const HSpace(4),
|
||||
CrudCollectionField(
|
||||
height: 110,
|
||||
width: 348,
|
||||
hint: 'Добавить описание',
|
||||
onTap: () {
|
||||
context.pushRoute(
|
||||
CrudCollectionFullscreenField(title: 'Описание', height: 333),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// Построение блока фото и заголовка
|
||||
Widget _buildPhotoAndTitle(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[_buildPhoto(), const WSpace(8), _buildTitle(context)],
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение поля для ввода заголовка
|
||||
Widget _buildTitle(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AppTypography('Название', type: SemiBold14px()),
|
||||
const HSpace(4),
|
||||
CrudCollectionField(
|
||||
height: 91,
|
||||
width: 225,
|
||||
hint: 'Добавить название',
|
||||
onTap: () {
|
||||
context.pushRoute(
|
||||
CrudCollectionFullscreenField(
|
||||
title: 'Название',
|
||||
hint: 'Максимальное количество символов - 250',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение обложки
|
||||
Widget _buildPhoto() {
|
||||
return SizedBox.square(
|
||||
dimension: 115.r,
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
colors: <Color>[Color(0xFFB6AAFE), Color(0xFFDBD7F4)],
|
||||
begin: Alignment.bottomLeft,
|
||||
end: Alignment.topRight,
|
||||
),
|
||||
),
|
||||
child: SizedBox.square(
|
||||
dimension: 32.r,
|
||||
child: Center(
|
||||
child: Assets.icons.typePhoto.image(
|
||||
height: 32.h,
|
||||
width: 32.w,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Построение шапки
|
||||
AppBar _buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
toolbarHeight: 56.h,
|
||||
backgroundColor: AppColors.white,
|
||||
shadowColor: Colors.transparent,
|
||||
leading: IconButton(
|
||||
onPressed: () async {
|
||||
if (widget.crudType == CrudType.EDIT) {
|
||||
final bool? res = await showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 262.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
title: 'Вы хотите сбросить все внесенные изменения?',
|
||||
acceptTitle: 'Да, сбросить',
|
||||
declineTitle: 'Нет, оставить',
|
||||
),
|
||||
);
|
||||
|
||||
if (res != null && res) context.back();
|
||||
} else {
|
||||
context.back();
|
||||
}
|
||||
},
|
||||
icon: const Icon(CupertinoIcons.left_chevron, color: Colors.black),
|
||||
),
|
||||
centerTitle: true,
|
||||
title: GestureDetector(
|
||||
onLongPress: () => context.pushRoute(const SandboxRoute()),
|
||||
child: AppTypography(
|
||||
widget.crudType == CrudType.CREATE
|
||||
? 'Создать коллекцию'
|
||||
: 'Редактировать',
|
||||
type: SemiBold20px(),
|
||||
color: AppColors.body_text,
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
Wif(
|
||||
condition: widget.crudType == CrudType.EDIT,
|
||||
builder: (BuildContext context) {
|
||||
return 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.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
|
||||
class CrudCollectionField extends StatelessWidget {
|
||||
const CrudCollectionField({
|
||||
super.key,
|
||||
this.height = 90,
|
||||
this.width = 100,
|
||||
this.onTap,
|
||||
this.hint = 'Hint',
|
||||
this.content,
|
||||
});
|
||||
|
||||
final double height;
|
||||
final double width;
|
||||
final void Function()? onTap;
|
||||
final String hint;
|
||||
final String? content;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: height.h,
|
||||
width: width.w,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)).r,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12).r,
|
||||
child:
|
||||
content != null
|
||||
? AppTypography(hint, maxLines: 99, type: Regular16px())
|
||||
: AppTypography(
|
||||
hint,
|
||||
maxLines: 99,
|
||||
type: Regular14px(),
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
106
lib/screens/dialogs/action_dialog.dart
Normal file
106
lib/screens/dialogs/action_dialog.dart
Normal file
@@ -0,0 +1,106 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:remever/common/functions.dart';
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/bottom_safe_space.dart';
|
||||
import 'package:remever/components/extensions/context.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
import 'package:remever/router.gr.dart';
|
||||
import 'package:remever/screens/crud_collection/crud_collection.dart';
|
||||
import 'package:remever/screens/dialogs/alert_dialog.dart';
|
||||
import 'package:remever/screens/dialogs/dialog_header.dart';
|
||||
import 'package:remever/screens/dialogs/dialog_item.dart';
|
||||
|
||||
class ActionDialog extends StatelessWidget {
|
||||
const ActionDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
const DialogHeader(title: 'Действия'),
|
||||
DialogItem(
|
||||
title: 'Публичная коллекция',
|
||||
dimension: 36,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: CupertinoSwitch(
|
||||
activeTrackColor: AppColors.primary,
|
||||
value: true,
|
||||
onChanged: (bool value) {},
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 282.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
title:
|
||||
'Коллекция станет видна всем пользователям сервиса.\nЕё будет проще найти по тэгам ;)',
|
||||
acceptTitle: 'Позже добавлю',
|
||||
declineTitle: 'Добавить тэги',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Исключена из тренировки',
|
||||
child: Assets.icons.typeHide.image(color: AppColors.primary),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Редактировать',
|
||||
child: Assets.icons.typeEdit.image(color: AppColors.primary),
|
||||
onTap: () {
|
||||
// context.back();
|
||||
context.pushRoute(CrudCollectionRoute(crudType: CrudType.EDIT));
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Статистика',
|
||||
child: Assets.icons.typeStat.image(color: AppColors.primary),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Скачать',
|
||||
child: Assets.icons.typeDownload.image(color: AppColors.primary),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Поделиться',
|
||||
child: Assets.icons.typeShare.image(color: AppColors.primary),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Удалить',
|
||||
color: AppColors.danger,
|
||||
onTap: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 262.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
title:
|
||||
'Вы хотите удалить коллекцию?\nЭто действие необратимо',
|
||||
acceptTitle: 'Да, удалить',
|
||||
declineTitle: 'Нет, оставить',
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Assets.icons.typeTrash.image(color: AppColors.danger),
|
||||
),
|
||||
const BottomSafeSpace(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
110
lib/screens/dialogs/alert_dialog.dart
Normal file
110
lib/screens/dialogs/alert_dialog.dart
Normal file
@@ -0,0 +1,110 @@
|
||||
import 'package:flutter/material.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/widgets/primary_button.dart';
|
||||
|
||||
class AlertInfoDialog extends StatelessWidget {
|
||||
const AlertInfoDialog({
|
||||
super.key,
|
||||
this.acceptTitle = '',
|
||||
this.declineTitle = '',
|
||||
this.title = '',
|
||||
});
|
||||
|
||||
final String? title;
|
||||
final String? acceptTitle;
|
||||
final String? declineTitle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16).r,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
const HSpace(32),
|
||||
_buildDanger(),
|
||||
const HSpace(24),
|
||||
AppTypography(
|
||||
title!,
|
||||
type: Medium16px(),
|
||||
maxLines: 3,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const HSpace(24),
|
||||
Material(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
PrimaryButton(
|
||||
width: 170,
|
||||
height: 52,
|
||||
color: AppColors.danger,
|
||||
onTap: () => Navigator.pop(context, true),
|
||||
child: AppTypography(
|
||||
acceptTitle!,
|
||||
type: Medium14px(),
|
||||
color: AppColors.white,
|
||||
),
|
||||
),
|
||||
PrimaryButton(
|
||||
width: 170,
|
||||
height: 52,
|
||||
color: AppColors.primary,
|
||||
onTap: () => Navigator.pop(context, false),
|
||||
child: AppTypography(
|
||||
declineTitle!,
|
||||
type: Medium14px(),
|
||||
color: AppColors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 16).r,
|
||||
child: GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: SizedBox.square(
|
||||
dimension: 24.r,
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.gray_bg,
|
||||
),
|
||||
child: Assets.icons.typeClose.image(
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDanger() {
|
||||
return SizedBox.square(
|
||||
dimension: 56.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: const Color(0xFFFFE4E6).withOpacity(0.4),
|
||||
),
|
||||
child: Center(
|
||||
child: Assets.icons.typeDanger.image(height: 24.h, width: 24.w),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class DialogHeader extends StatelessWidget {
|
||||
decoration: _closeButtonDecoration,
|
||||
child: Center(
|
||||
child: Assets.icons.typeClose.image(
|
||||
color: AppColors.gray,
|
||||
color: AppColors.disabled,
|
||||
height: _iconSize.h,
|
||||
width: _iconSize.w,
|
||||
),
|
||||
|
||||
@@ -23,7 +23,7 @@ class DialogItem extends StatelessWidget {
|
||||
final double dimension;
|
||||
|
||||
// Константы для стилей и отступов
|
||||
static final double _itemHeight = 56.h;
|
||||
static final double _itemHeight = 52.h;
|
||||
static const BoxDecoration _itemDecoration = BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: AppColors.gray, width: 0.5)),
|
||||
);
|
||||
@@ -37,7 +37,7 @@ class DialogItem extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: _itemHeight.h,
|
||||
height: _itemHeight,
|
||||
decoration: _itemDecoration,
|
||||
child: Padding(
|
||||
padding: _itemPadding,
|
||||
@@ -62,7 +62,7 @@ class DialogItem extends StatelessWidget {
|
||||
Widget _buildTitle() {
|
||||
return AppTypography(
|
||||
title,
|
||||
color: color ?? AppColors.black,
|
||||
color: color ?? Colors.black,
|
||||
type: _regular17Style,
|
||||
);
|
||||
}
|
||||
|
||||
61
lib/screens/dialogs/filters_dialog copy.dart
Normal file
61
lib/screens/dialogs/filters_dialog copy.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remever/common/widgets/bottom_safe_space.dart';
|
||||
import 'package:remever/gen/assets.gen.dart';
|
||||
import 'package:remever/screens/dialogs/dialog_header.dart';
|
||||
import 'package:remever/screens/dialogs/dialog_item.dart';
|
||||
|
||||
class FiltersDialog extends StatelessWidget {
|
||||
const FiltersDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
const DialogHeader(title: 'Сортировка'),
|
||||
DialogItem(
|
||||
title: 'Сначала Мои коллекции',
|
||||
child: Assets.icons.typeSortA.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'Сначала коллекции на изучении',
|
||||
child: Assets.icons.typeSortA.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По дате обновления',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По уровню изученности',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По популярностии',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
DialogItem(
|
||||
title: 'По количеству карточек',
|
||||
child: Assets.icons.typeSortDown.image(),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
const BottomSafeSpace(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
96
lib/screens/dialogs/info_dialog.dart
Normal file
96
lib/screens/dialogs/info_dialog.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
import 'package:flutter/material.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/widgets/primary_button.dart';
|
||||
|
||||
class InfoDialog extends StatelessWidget {
|
||||
const InfoDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(color: Colors.white),
|
||||
constraints: BoxConstraints(
|
||||
minHeight: MediaQuery.sizeOf(context).height / 6,
|
||||
maxHeight: MediaQuery.sizeOf(context).height / 1.1,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 16).r,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
_buildAvatar(),
|
||||
const WSpace(5),
|
||||
Flexible(child: _buildCollectionTitle()),
|
||||
],
|
||||
),
|
||||
const HSpace(8),
|
||||
_buildText(),
|
||||
const HSpace(16),
|
||||
PrimaryButton(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
color: AppColors.primary,
|
||||
child: AppTypography(
|
||||
'Закрыть',
|
||||
type: Medium14px(),
|
||||
color: AppColors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildText() {
|
||||
return Flexible(
|
||||
child: SingleChildScrollView(
|
||||
controller: ScrollController(),
|
||||
child: AppTypography(
|
||||
'Предварительные выводы неутешительны: убеждённость некоторых оппонентов способствует подготовке и реализации форм воздействия. Как принято считать, предприниматели в сети интернет представляют собой не что иное, как квинтэссенцию победы маркетинга над разумом и должны быть описаны максимально подробно.'
|
||||
'Идейные соображения высшего порядка, а также высокотехнологичная концепция общественного уклада говорит о возможностях кластеризации усилий. Задача организации, в особенности же реализация намеченных плановых заданий выявляет срочную потребность первоочередных требований. Вот вам яркий пример современных тенденций — существующая теория обеспечивает широкому кругу (специалистов) участие в формировании поставленных обществом задач. Имеется спорная точка зрения, гласящая примерно следующее: сторонники тоталитаризма в науке освещают чрезвычайно интересные особенности картины в целом, однако конкретные выводы, разумеется, представлены в исключительно положительном свете. Лишь базовые сценарии поведения пользователей представляют собой не что иное, как квинтэссенцию победы маркетинга над разумом и должны быть функционально разнесены на независимые элементы. Каждый из нас понимает очевидную вещь: начало повседневной работы по формированию позиции способствует повышению качества распределения внутренних резервов и ресурсов.'
|
||||
'В своём стремлении улучшить пользовательский опыт мы упускаем, что тщательные исследования конкурентов набирают популярность среди определенных слоев населения, а значит, должны быть представлены в исключительно положительном свете. Противоположная точка зрения подразумевает, что непосредственные участники технического прогресса преданы социально-демократической анафеме. Вот вам яркий пример современных тенденций — выбранный нами инновационный путь не оставляет шанса для поставленных обществом задач. Задача организации, в особенности же понимание сути ресурсосберегающих технологий влечет за собой процесс внедрения и модернизации новых принципов формирования материально-технической и кадровой базы. В своём стремлении улучшить пользовательский опыт мы упускаем, что непосредственные участники технического прогресса ассоциативно распределены по отраслям. Высокий уровень вовлечения представителей целевой аудитории является четким доказательством простого факта: синтетическое тестирование влечет за собой процесс внедрения и модернизации системы массового участия!'
|
||||
'Сложно сказать, почему стремящиеся вытеснить традиционное производство, нанотехнологии призваны к ответу. Но предприниматели в сети интернет, инициированные исключительно синтетически, призваны к ответу. Следует отметить, что экономическая повестка сегодняшнего дня способствует подготовке и реализации глубокомысленных рассуждений. Равным образом, укрепление и развитие внутренней структуры в значительной степени обусловливает важность соответствующих условий активизации. Противоположная точка зрения подразумевает, что диаграммы связей будут призваны к ответу. И нет сомнений, что независимые государства формируют глобальную экономическую сеть и при этом — ограничены исключительно образом мышления.'
|
||||
'И нет сомнений, что реплицированные с зарубежных источников, современные исследования освещают чрезвычайно интересные особенности картины в целом, однако конкретные выводы, разумеется, разоблачены! Мы вынуждены отталкиваться от того, что современная методология разработки говорит о возможностях как самодостаточных, так и внешне зависимых концептуальных решений. Повседневная практика показывает, что курс на социально-ориентированный национальный проект требует от нас анализа распределения внутренних резервов и ресурсов. Задача организации, в особенности же курс на социально-ориентированный национальный проект представляет собой интересный эксперимент проверки укрепления моральных ценностей. Значимость этих проблем настолько очевидна, что социально-экономическое развитие говорит о возможностях кластеризации усилий. Не следует, однако, забывать, что дальнейшее развитие различных форм деятельности в значительной степени обусловливает важность прогресса профессионального сообщества.'
|
||||
'А ещё реплицированные с зарубежных источников, современные исследования могут быть превращены в посмешище, хотя само их существование приносит несомненную пользу обществу. Задача организации, в особенности же социально-экономическое развитие является качественно новой ступенью системы обучения кадров, соответствующей насущным потребностям. В целом, конечно, начало повседневной работы по формированию позиции требует анализа поставленных обществом задач. Но курс на социально-ориентированный национальный проект говорит о возможностях экспериментов, поражающих по своей масштабности и грандиозности. Прежде всего, существующая теория создаёт предпосылки для экономической целесообразности принимаемых решений. Внезапно, представители современных социальных резервов лишь добавляют фракционных разногласий и разоблачены.'
|
||||
'В рамках спецификации современных стандартов, действия представителей оппозиции ассоциативно распределены по отраслям. Не следует, однако, забывать, что новая модель организационной деятельности позволяет оценить значение соответствующих условий активизации. Значимость этих проблем настолько очевидна, что курс на социально-ориентированный национальный проект позволяет выполнить важные задания по разработке глубокомысленных рассуждений. Современные технологии достигли такого уровня, что начало повседневной работы по формированию позиции обеспечивает широкому кругу (специалистов) участие в формировании инновационных методов управления процессами. Имеется спорная точка зрения, гласящая примерно следующее: активно развивающиеся страны третьего мира будут объявлены нарушающими общечеловеческие нормы этики и морали. Картельные сговоры не допускают ситуации, при которой диаграммы связей будут обнародованы.',
|
||||
type: Regular14px(),
|
||||
maxLines: 9999,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Название коллекции
|
||||
///
|
||||
Widget _buildCollectionTitle() {
|
||||
return AppTypography(
|
||||
'Астрономия и тайная комната Харли Хоттера',
|
||||
type: Medium16px(),
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
color: AppColors.primary,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Обложка коллекции
|
||||
///
|
||||
Widget _buildAvatar() {
|
||||
return SizedBox.square(
|
||||
dimension: 40.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(image: Assets.images.img.provider()),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
167
lib/screens/dialogs/replace_diaog.dart
Normal file
167
lib/screens/dialogs/replace_diaog.dart
Normal file
@@ -0,0 +1,167 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.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/router.gr.dart';
|
||||
import 'package:remever/screens/collections/widgets/collection_progress_bar.dart';
|
||||
import 'package:remever/screens/dialogs/dialog_header.dart';
|
||||
|
||||
class ReplaceDialog extends StatelessWidget {
|
||||
const ReplaceDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
const DialogHeader(title: 'Переместить карточку'),
|
||||
const HSpace(16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 28).r,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AppTypography('из коллекции', type: Medium16px()),
|
||||
const HSpace(8),
|
||||
_buildCollection(context),
|
||||
const HSpace(16),
|
||||
Center(
|
||||
child: SizedBox.square(
|
||||
dimension: 34.r,
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.gray,
|
||||
),
|
||||
child: Center(
|
||||
child: Assets.icons.typeArrowDown.image(
|
||||
height: 18.h,
|
||||
width: 18.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const HSpace(16),
|
||||
AppTypography('в коллекцию', type: Medium16px()),
|
||||
const HSpace(8),
|
||||
_buildCollection(context),
|
||||
const HSpace(16),
|
||||
_createBtn(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _createBtn(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
// context.read<HomeCubit>().toCrudCollection(CrudType.CREATE);
|
||||
context.pushRoute(CrudCollectionRoute());
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox.square(
|
||||
dimension: 20.r,
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColors.gray,
|
||||
),
|
||||
child: Assets.icons.typePlus.image(color: Colors.black54),
|
||||
),
|
||||
),
|
||||
const WSpace(4),
|
||||
AppTypography('Создать и перенести в новую', type: Regular16px()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCollection(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
constraints: BoxConstraints(minHeight: 66.h, maxHeight: 84.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12).r,
|
||||
color: AppColors.white,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8).r,
|
||||
child: Row(
|
||||
children: <Widget>[_buildAvatar(), const WSpace(5), _buildInfo()],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Построение основной информации
|
||||
///
|
||||
Widget _buildInfo() {
|
||||
return SizedBox(
|
||||
width: 230.w,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
_buildTitle(),
|
||||
const HSpace(4),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Assets.icons.typeCards.image(
|
||||
height: 18.h,
|
||||
width: 18.w,
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
const WSpace(2),
|
||||
AppTypography(
|
||||
Random().nextInt(654).toString(),
|
||||
type: Regular14px(),
|
||||
color: AppColors.disabled,
|
||||
),
|
||||
],
|
||||
),
|
||||
const HSpace(6),
|
||||
const CollectionProgressBar(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Название коллекции
|
||||
///
|
||||
Widget _buildTitle() {
|
||||
return AppTypography(
|
||||
'Астрономия',
|
||||
type: Medium16px(),
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Обложка коллекции
|
||||
///
|
||||
Widget _buildAvatar() {
|
||||
return SizedBox.square(
|
||||
dimension: 50.r,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(image: Assets.images.img.provider()),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
103
lib/screens/dialogs/tags_dialog.dart
Normal file
103
lib/screens/dialogs/tags_dialog.dart
Normal file
@@ -0,0 +1,103 @@
|
||||
import 'package:flutter/material.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';
|
||||
import 'package:remever/screens/dialogs/dialog_header.dart';
|
||||
|
||||
class TagsDialog extends StatelessWidget {
|
||||
const TagsDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: <Widget>[_header(context), _body(context)]);
|
||||
}
|
||||
|
||||
/// Тело диалога
|
||||
Widget _body(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16).r,
|
||||
child: Wrap(
|
||||
runSpacing: 8.r,
|
||||
spacing: 8.r,
|
||||
children: List<Widget>.generate(11, (int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(6)).r,
|
||||
color: const Color(0xFFFFE4E6),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
AppTypography(
|
||||
'tag $index',
|
||||
type: Regular14px(),
|
||||
height: 0.95,
|
||||
color: AppColors.danger,
|
||||
),
|
||||
const WSpace(8),
|
||||
Center(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 14.r,
|
||||
color: AppColors.danger,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Шапка
|
||||
Widget _header(BuildContext context) {
|
||||
return DialogHeader(
|
||||
paddingSize: 16,
|
||||
title: 'Тэги',
|
||||
action: GestureDetector(
|
||||
onTap: () {
|
||||
showCuperModalBottomSheet(
|
||||
context: context,
|
||||
height: 282.h,
|
||||
builder:
|
||||
(BuildContext context) => const AlertInfoDialog(
|
||||
title: 'Удалить все тэги?\nЭто действие необратимо',
|
||||
acceptTitle: 'Да, удалить все',
|
||||
declineTitle: 'Нет, оставьте',
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SizedBox.square(
|
||||
dimension: 24.r,
|
||||
child: Assets.icons.typeTrash.image(color: AppColors.danger),
|
||||
),
|
||||
const WSpace(4),
|
||||
AppTypography(
|
||||
'Удалить все',
|
||||
type: Medium16px(),
|
||||
color: AppColors.danger,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,18 +26,21 @@ class HomeScreen extends StatelessWidget {
|
||||
routes: <PageRouteInfo>[
|
||||
SettingsRoute(),
|
||||
StatistickRoute(),
|
||||
CrudCollection(),
|
||||
CreateRoute(),
|
||||
CollectionRoute(),
|
||||
],
|
||||
bottomNavigationBuilder: (_, TabsRouter tabsRouter) {
|
||||
return SizedBox(
|
||||
height: 73.h,
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: <Widget>[
|
||||
_buildBackgroundBar(tabsRouter),
|
||||
_buildCentralButton(),
|
||||
],
|
||||
return ColoredBox(
|
||||
color: AppColors.bg,
|
||||
child: SizedBox(
|
||||
height: 73.h,
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: <Widget>[
|
||||
_buildBackgroundBar(tabsRouter),
|
||||
_buildCentralButton(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
129
lib/screens/sandbox/sandbox_screen.dart
Normal file
129
lib/screens/sandbox/sandbox_screen.dart
Normal file
@@ -0,0 +1,129 @@
|
||||
import 'package:auto_route/annotations.dart';
|
||||
import 'package:drift/src/runtime/api/runtime_api.dart';
|
||||
import 'package:drift_db_viewer/drift_db_viewer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it_mixin/get_it_mixin.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
import 'package:remever/common/widgets/wspace.dart';
|
||||
import 'package:remever/database/database.dart';
|
||||
|
||||
import '../../components/notifiers/app_settings.dart';
|
||||
import '../../components/env.dart';
|
||||
import '../../inject.dart';
|
||||
|
||||
@RoutePage()
|
||||
class SandboxScreen extends StatefulWidget {
|
||||
const SandboxScreen({super.key});
|
||||
|
||||
@override
|
||||
State<SandboxScreen> createState() => _SandboxScreenState();
|
||||
}
|
||||
|
||||
class _SandboxScreenState extends State<SandboxScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppTypography('Песочница')),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: <Widget>[
|
||||
_buildVersion(),
|
||||
const HSpace(8),
|
||||
Text('${getIt<Env>().runtimeType}:${getIt<Env>().url}'),
|
||||
const HSpace(8),
|
||||
_debugBox(),
|
||||
const HSpace(8),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _debugBox() {
|
||||
return DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
border: Border.fromBorderSide(
|
||||
BorderSide(width: 1, color: Colors.black),
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
const AppTypography('debug'),
|
||||
ShowFpsSetting(),
|
||||
EnableDebugSetting(),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<dynamic>(
|
||||
builder: (BuildContext context) {
|
||||
return DriftDbViewer(getIt<AppDatabase>());
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('Open Db Viewer'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildVersion() {
|
||||
return FutureBuilder<PackageInfo>(
|
||||
future: PackageInfo.fromPlatform(),
|
||||
builder: (BuildContext context, AsyncSnapshot<PackageInfo> snapshot) {
|
||||
return AppTypography(
|
||||
'Версия: ${snapshot.data?.version ?? '-'}'
|
||||
'+${snapshot.data?.buildNumber ?? '-'}',
|
||||
type: Bold14px(),
|
||||
//color: Colors.black,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ShowFpsSetting extends StatelessWidget with GetItMixin {
|
||||
///
|
||||
/// Виджет для контроля показа FPS
|
||||
///
|
||||
ShowFpsSetting({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool showFPS = watchOnly<AppSettingsNotifier, bool>(
|
||||
(AppSettingsNotifier e) => e.showFps,
|
||||
);
|
||||
|
||||
return SwitchListTile.adaptive(
|
||||
value: showFPS,
|
||||
title: const Text('Show FPS'),
|
||||
activeColor: Colors.blueAccent,
|
||||
onChanged: (_) {
|
||||
if (context.mounted) get<AppSettingsNotifier>().toggleFps();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EnableDebugSetting extends StatelessWidget with GetItMixin {
|
||||
///
|
||||
/// Виджет для включения общего дебага
|
||||
///
|
||||
EnableDebugSetting({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool debugMode = watchOnly<AppSettingsNotifier, bool>(
|
||||
(AppSettingsNotifier e) => e.debugMode,
|
||||
);
|
||||
|
||||
return SwitchListTile.adaptive(
|
||||
value: debugMode,
|
||||
title: const Text('Debug mode'),
|
||||
activeColor: Colors.blueAccent,
|
||||
onChanged: (_) => get<AppSettingsNotifier>().toggleDebugMode(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user