|
@@ -11,6 +11,7 @@ import 'package:flowy_infra/theme_extension.dart';
|
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
|
|
+import 'package:flowy_infra_ui/widget/spacing.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
|
|
@@ -83,7 +84,7 @@ class _ChangeCoverPopoverState extends State<ChangeCoverPopover> {
|
|
child: BlocBuilder<ChangeCoverPopoverBloc, ChangeCoverPopoverState>(
|
|
child: BlocBuilder<ChangeCoverPopoverBloc, ChangeCoverPopoverState>(
|
|
builder: (context, state) {
|
|
builder: (context, state) {
|
|
return Padding(
|
|
return Padding(
|
|
- padding: const EdgeInsets.all(15),
|
|
|
|
|
|
+ padding: const EdgeInsets.all(12),
|
|
child: SingleChildScrollView(
|
|
child: SingleChildScrollView(
|
|
child: isAddingImage
|
|
child: isAddingImage
|
|
? CoverImagePicker(
|
|
? CoverImagePicker(
|
|
@@ -116,18 +117,18 @@ class _ChangeCoverPopoverState extends State<ChangeCoverPopover> {
|
|
LocaleKeys.document_plugins_cover_colors.tr(),
|
|
LocaleKeys.document_plugins_cover_colors.tr(),
|
|
color: Theme.of(context).colorScheme.tertiary,
|
|
color: Theme.of(context).colorScheme.tertiary,
|
|
),
|
|
),
|
|
- const SizedBox(height: 10),
|
|
|
|
|
|
+ const VSpace(10),
|
|
_buildColorPickerList(),
|
|
_buildColorPickerList(),
|
|
- const SizedBox(height: 10),
|
|
|
|
|
|
+ const VSpace(10),
|
|
_buildImageHeader(),
|
|
_buildImageHeader(),
|
|
- const SizedBox(height: 10),
|
|
|
|
|
|
+ const VSpace(10),
|
|
_buildFileImagePicker(),
|
|
_buildFileImagePicker(),
|
|
- const SizedBox(height: 10),
|
|
|
|
|
|
+ const VSpace(10),
|
|
FlowyText.semibold(
|
|
FlowyText.semibold(
|
|
LocaleKeys.document_plugins_cover_abstract.tr(),
|
|
LocaleKeys.document_plugins_cover_abstract.tr(),
|
|
color: Theme.of(context).colorScheme.tertiary,
|
|
color: Theme.of(context).colorScheme.tertiary,
|
|
),
|
|
),
|
|
- const SizedBox(height: 10),
|
|
|
|
|
|
+ const VSpace(10),
|
|
_buildAbstractImagePicker(),
|
|
_buildAbstractImagePicker(),
|
|
],
|
|
],
|
|
);
|
|
);
|
|
@@ -249,27 +250,9 @@ class _ChangeCoverPopoverState extends State<ChangeCoverPopover> {
|
|
itemCount: images.length + 1,
|
|
itemCount: images.length + 1,
|
|
itemBuilder: (BuildContext ctx, index) {
|
|
itemBuilder: (BuildContext ctx, index) {
|
|
if (index == 0) {
|
|
if (index == 0) {
|
|
- return Container(
|
|
|
|
- decoration: BoxDecoration(
|
|
|
|
- border: Border.all(
|
|
|
|
- color: Theme.of(context).colorScheme.primary,
|
|
|
|
- ),
|
|
|
|
- borderRadius: Corners.s8Border,
|
|
|
|
- ),
|
|
|
|
- child: FlowyIconButton(
|
|
|
|
- iconPadding: EdgeInsets.zero,
|
|
|
|
- icon: Icon(
|
|
|
|
- Icons.add,
|
|
|
|
- color: Theme.of(context).colorScheme.primary,
|
|
|
|
- ),
|
|
|
|
- hoverColor:
|
|
|
|
- Theme.of(context).colorScheme.primary.withOpacity(0.15),
|
|
|
|
- width: 20,
|
|
|
|
- onPressed: () {
|
|
|
|
- setState(() {
|
|
|
|
- isAddingImage = true;
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ return NewCustomCoverButton(
|
|
|
|
+ onPressed: () => setState(
|
|
|
|
+ () => isAddingImage = true,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -328,6 +311,32 @@ class _ChangeCoverPopoverState extends State<ChangeCoverPopover> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+@visibleForTesting
|
|
|
|
+class NewCustomCoverButton extends StatelessWidget {
|
|
|
|
+ final VoidCallback onPressed;
|
|
|
|
+ const NewCustomCoverButton({super.key, required this.onPressed});
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
+ return Container(
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
+ border: Border.all(
|
|
|
|
+ color: Theme.of(context).colorScheme.primary,
|
|
|
|
+ ),
|
|
|
|
+ borderRadius: Corners.s8Border,
|
|
|
|
+ ),
|
|
|
|
+ child: FlowyIconButton(
|
|
|
|
+ icon: Icon(
|
|
|
|
+ Icons.add,
|
|
|
|
+ color: Theme.of(context).colorScheme.primary,
|
|
|
|
+ ),
|
|
|
|
+ hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.15),
|
|
|
|
+ onPressed: onPressed,
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
class DeleteImageAlertDialog extends StatelessWidget {
|
|
class DeleteImageAlertDialog extends StatelessWidget {
|
|
const DeleteImageAlertDialog({
|
|
const DeleteImageAlertDialog({
|
|
Key? key,
|
|
Key? key,
|