♻️ Refactored publisher creation into sheet
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/models/file.dart';
|
||||
import 'package:island/models/post.dart';
|
||||
@@ -330,7 +329,13 @@ class PostComposeCard extends HookConsumerWidget {
|
||||
if (isContained) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
context.pushNamed('creatorNew').then((value) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useRootNavigator: true,
|
||||
builder:
|
||||
(context) => const NewPublisherScreen(),
|
||||
).then((value) {
|
||||
if (value != null) {
|
||||
composeState.currentPublisher.value =
|
||||
value as SnPublisher;
|
||||
@@ -368,9 +373,14 @@ class PostComposeCard extends HookConsumerWidget {
|
||||
if (isContained) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
context.pushNamed('creatorNew').then((
|
||||
value,
|
||||
) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useRootNavigator: true,
|
||||
builder:
|
||||
(context) =>
|
||||
const NewPublisherScreen(),
|
||||
).then((value) {
|
||||
if (value != null) {
|
||||
composeState.currentPublisher.value =
|
||||
value as SnPublisher;
|
||||
|
||||
@@ -123,7 +123,7 @@ class ComposeLogic {
|
||||
slugController: TextEditingController(text: originalPost?.slug),
|
||||
visibility: ValueNotifier<int>(originalPost?.visibility ?? 0),
|
||||
submitting: ValueNotifier<bool>(false),
|
||||
attachmentProgress: ValueNotifier<Map<int, double>>({}),
|
||||
attachmentProgress: ValueNotifier<Map<int, double?>>({}),
|
||||
currentPublisher: ValueNotifier<SnPublisher?>(originalPost?.publisher),
|
||||
tags: ValueNotifier<List<String>>(tags),
|
||||
categories: ValueNotifier<List<SnPostCategory>>(categories),
|
||||
@@ -149,7 +149,7 @@ class ComposeLogic {
|
||||
slugController: TextEditingController(text: draft.slug),
|
||||
visibility: ValueNotifier<int>(draft.visibility),
|
||||
submitting: ValueNotifier<bool>(false),
|
||||
attachmentProgress: ValueNotifier<Map<int, double>>({}),
|
||||
attachmentProgress: ValueNotifier<Map<int, double?>>({}),
|
||||
currentPublisher: ValueNotifier<SnPublisher?>(null),
|
||||
tags: ValueNotifier<List<String>>(tags),
|
||||
categories: ValueNotifier<List<SnPostCategory>>(draft.categories),
|
||||
@@ -500,7 +500,7 @@ class ComposeLogic {
|
||||
try {
|
||||
state.attachmentProgress.value = {
|
||||
...state.attachmentProgress.value,
|
||||
index: 0,
|
||||
index: 0.0,
|
||||
};
|
||||
|
||||
SnCloudFile? cloudFile;
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:math' as math;
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/screens/creators/publishers_form.dart';
|
||||
import 'package:island/widgets/content/cloud_files.dart';
|
||||
@@ -43,9 +42,13 @@ class PublisherModal extends HookConsumerWidget {
|
||||
const Gap(12),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.pushNamed('creatorNew').then((
|
||||
value,
|
||||
) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder:
|
||||
(context) =>
|
||||
const NewPublisherScreen(),
|
||||
).then((value) {
|
||||
if (value != null) {
|
||||
ref.invalidate(
|
||||
publishersManagedProvider,
|
||||
|
||||
Reference in New Issue
Block a user