💄 Optimize poll editor
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:island/pods/network.dart';
|
|||||||
import 'package:island/widgets/alert.dart';
|
import 'package:island/widgets/alert.dart';
|
||||||
import 'package:island/models/poll.dart';
|
import 'package:island/models/poll.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
|
||||||
@@ -516,8 +517,7 @@ class PollEditorScreen extends ConsumerWidget {
|
|||||||
if (model.questions.isEmpty)
|
if (model.questions.isEmpty)
|
||||||
_EmptyState(
|
_EmptyState(
|
||||||
title: 'pollNoQuestionsYet'.tr(),
|
title: 'pollNoQuestionsYet'.tr(),
|
||||||
subtitle:
|
subtitle: 'pollNoQuestionsHint'.tr(),
|
||||||
'pollNoQuestionsHint'.tr(),
|
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ReorderableListView.builder(
|
ReorderableListView.builder(
|
||||||
@@ -579,24 +579,32 @@ class PollEditorScreen extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Material(
|
||||||
children: [
|
elevation: 2,
|
||||||
OutlinedButton.icon(
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
onPressed: () {
|
child: Row(
|
||||||
Navigator.of(context).maybePop();
|
children: [
|
||||||
},
|
OutlinedButton.icon(
|
||||||
icon: const Icon(Icons.close),
|
onPressed: () {
|
||||||
label: Text('cancel'.tr()),
|
Navigator.of(context).maybePop();
|
||||||
),
|
},
|
||||||
const Spacer(),
|
icon: const Icon(Icons.close),
|
||||||
FilledButton.icon(
|
label: Text('cancel'.tr()),
|
||||||
onPressed: () {
|
),
|
||||||
_submitPoll(context, ref);
|
const Spacer(),
|
||||||
},
|
FilledButton.icon(
|
||||||
icon: const Icon(Icons.cloud_upload_outlined),
|
onPressed: () {
|
||||||
label: Text(model.id == null ? 'create'.tr() : 'update'.tr()),
|
_submitPoll(context, ref);
|
||||||
),
|
},
|
||||||
],
|
icon: const Icon(Icons.cloud_upload_outlined),
|
||||||
|
label: Text(model.id == null ? 'create'.tr() : 'update'.tr()),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(
|
||||||
|
horizontal: 24,
|
||||||
|
top: 16,
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 16,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -1049,7 +1057,9 @@ class _TextAnswerPreview extends StatelessWidget {
|
|||||||
maxLines: long ? 4 : 1,
|
maxLines: long ? 4 : 1,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText:
|
labelText:
|
||||||
long ? 'pollLongTextAnswerPreview'.tr() : 'pollShortTextAnswerPreview'.tr(),
|
long
|
||||||
|
? 'pollLongTextAnswerPreview'.tr()
|
||||||
|
: 'pollShortTextAnswerPreview'.tr(),
|
||||||
border: const OutlineInputBorder(
|
border: const OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
),
|
),
|
||||||
@@ -1083,9 +1093,15 @@ class _EmptyState extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('pollNoQuestionsYet'.tr(), style: Theme.of(context).textTheme.titleMedium),
|
Text(
|
||||||
|
'pollNoQuestionsYet'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
const Gap(4),
|
const Gap(4),
|
||||||
Text('pollNoQuestionsHint'.tr(), style: Theme.of(context).textTheme.bodyMedium),
|
Text(
|
||||||
|
'pollNoQuestionsHint'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user