Initial UI of search

pull/899/head
X Code 3 years ago
parent 1a0dfa1d45
commit 777951e012
  1. 23
      lib/src/translations/toolbar.i18n.dart
  2. 2
      lib/src/widgets/toolbar.dart
  3. 80
      lib/src/widgets/toolbar/search_button.dart

@ -28,6 +28,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'en_us': { 'en_us': {
'Paste a link': 'Paste a link', 'Paste a link': 'Paste a link',
@ -54,6 +55,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'ar': { 'ar': {
'Paste a link': 'نسخ الرابط', 'Paste a link': 'نسخ الرابط',
@ -80,6 +82,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'da': { 'da': {
'Paste a link': 'Indsæt link', 'Paste a link': 'Indsæt link',
@ -106,6 +109,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'de': { 'de': {
'Paste a link': 'Link hinzufügen', 'Paste a link': 'Link hinzufügen',
@ -133,6 +137,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'fr': { 'fr': {
'Paste a link': 'Coller un lien', 'Paste a link': 'Coller un lien',
@ -159,6 +164,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'zh_CN': { 'zh_CN': {
'Paste a link': '粘贴链接', 'Paste a link': '粘贴链接',
@ -185,6 +191,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'ko': { 'ko': {
'Paste a link': '링크를 붙여넣어 주세요.', 'Paste a link': '링크를 붙여넣어 주세요.',
@ -210,6 +217,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'ru': { 'ru': {
'Paste a link': 'Вставить ссылку', 'Paste a link': 'Вставить ссылку',
@ -236,6 +244,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'es': { 'es': {
'Paste a link': 'Pega un enlace', 'Paste a link': 'Pega un enlace',
@ -263,6 +272,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'tr': { 'tr': {
'Paste a link': 'Bağlantıyı Yapıştır', 'Paste a link': 'Bağlantıyı Yapıştır',
@ -289,6 +299,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'uk': { 'uk': {
'Paste a link': 'Вставити посилання', 'Paste a link': 'Вставити посилання',
@ -315,6 +326,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'pt': { 'pt': {
'Paste a link': 'Colar um link', 'Paste a link': 'Colar um link',
@ -342,6 +354,7 @@ extension Localization on String {
'Huge': 'Gigante', 'Huge': 'Gigante',
'Clear': 'Limpar', 'Clear': 'Limpar',
'Font': 'Fonte', 'Font': 'Fonte',
'Search': 'Search',
}, },
'pl': { 'pl': {
'Paste a link': 'Wklej link', 'Paste a link': 'Wklej link',
@ -369,6 +382,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'vi': { 'vi': {
'Paste a link': 'Chèn liên kết', 'Paste a link': 'Chèn liên kết',
@ -396,6 +410,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'ur': { 'ur': {
'Paste a link': 'لنک پیسٹ کریں', 'Paste a link': 'لنک پیسٹ کریں',
@ -422,6 +437,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'id': { 'id': {
'Paste a link': 'Tempel tautan', 'Paste a link': 'Tempel tautan',
@ -448,6 +464,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'no': { 'no': {
'Paste a link': 'Lim inn lenke', 'Paste a link': 'Lim inn lenke',
@ -474,6 +491,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'fa': { 'fa': {
'Paste a link': 'جایگذاری لینک', 'Paste a link': 'جایگذاری لینک',
@ -500,6 +518,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'hi': { 'hi': {
'Paste a link': 'िक पट कर', 'Paste a link': 'िक पट कर',
@ -526,6 +545,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'nl': { 'nl': {
'Paste a link': 'Plak een link', 'Paste a link': 'Plak een link',
@ -552,6 +572,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'zh_HK': { 'zh_HK': {
'Paste a link': '貼上連結', 'Paste a link': '貼上連結',
@ -578,6 +599,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
'sr': { 'sr': {
'Paste a link': 'Nalepi vezu', 'Paste a link': 'Nalepi vezu',
@ -604,6 +626,7 @@ extension Localization on String {
'Huge': 'Huge', 'Huge': 'Huge',
'Clear': 'Clear', 'Clear': 'Clear',
'Font': 'Font', 'Font': 'Font',
'Search': 'Search',
}, },
}; };

@ -111,7 +111,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
bool showVideoButton = true, bool showVideoButton = true,
bool showCameraButton = true, bool showCameraButton = true,
bool showDirection = false, bool showDirection = false,
bool showSearchButton = true, bool showSearchButton = false,
OnImagePickCallback? onImagePickCallback, OnImagePickCallback? onImagePickCallback,
OnVideoPickCallback? onVideoPickCallback, OnVideoPickCallback? onVideoPickCallback,
MediaPickSettingSelector? mediaPickSettingSelector, MediaPickSettingSelector? mediaPickSettingSelector,

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import '../../models/themes/quill_dialog_theme.dart'; import '../../models/themes/quill_dialog_theme.dart';
import '../../models/themes/quill_icon_theme.dart'; import '../../models/themes/quill_icon_theme.dart';
import '../../translations/toolbar.i18n.dart';
import '../controller.dart'; import '../controller.dart';
import '../toolbar.dart'; import '../toolbar.dart';
@ -10,6 +11,7 @@ class SearchButton extends StatelessWidget {
required this.icon, required this.icon,
required this.controller, required this.controller,
this.iconSize = kDefaultIconSize, this.iconSize = kDefaultIconSize,
this.fillColor,
this.iconTheme, this.iconTheme,
this.dialogTheme, this.dialogTheme,
Key? key, Key? key,
@ -19,14 +21,86 @@ class SearchButton extends StatelessWidget {
final double iconSize; final double iconSize;
final QuillController controller; final QuillController controller;
final Color? fillColor;
final QuillIconTheme? iconTheme; final QuillIconTheme? iconTheme;
final QuillDialogTheme? dialogTheme; final QuillDialogTheme? dialogTheme;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// TODO: implement floating search bar final theme = Theme.of(context);
return const SizedBox();
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
final iconFillColor =
iconTheme?.iconUnselectedFillColor ?? (fillColor ?? theme.canvasColor);
return QuillIconButton(
icon: Icon(icon, size: iconSize, color: iconColor),
highlightElevation: 0,
hoverElevation: 0,
size: iconSize * 1.77,
fillColor: iconFillColor,
borderRadius: iconTheme?.borderRadius ?? 2,
onPressed: () => _onPressedHandler(context),
);
}
Future<void> _onPressedHandler(BuildContext context) async {
await showDialog<String>(
context: context,
builder: (_) => _SearchDialog(dialogTheme: dialogTheme, text: ''),
).then(_searchSubmitted);
}
void _searchSubmitted(String? value) {}
}
class _SearchDialog extends StatefulWidget {
const _SearchDialog({this.dialogTheme, this.text, Key? key})
: super(key: key);
final QuillDialogTheme? dialogTheme;
final String? text;
@override
_SearchDialogState createState() => _SearchDialogState();
}
class _SearchDialogState extends State<_SearchDialog> {
late String _text;
late TextEditingController _controller;
@override
void initState() {
super.initState();
_text = widget.text ?? '';
_controller = TextEditingController(text: _text);
}
@override
Widget build(BuildContext context) {
return AlertDialog(
backgroundColor: widget.dialogTheme?.dialogBackgroundColor,
content: TextField(
keyboardType: TextInputType.multiline,
maxLines: null,
style: widget.dialogTheme?.inputTextStyle,
decoration: InputDecoration(
labelText: 'Search'.i18n,
labelStyle: widget.dialogTheme?.labelTextStyle,
floatingLabelStyle: widget.dialogTheme?.labelTextStyle),
autofocus: true,
controller: _controller,
),
actions: [
TextButton(
onPressed: () {},
child: Text(
'Ok'.i18n,
style: widget.dialogTheme?.labelTextStyle,
),
),
],
);
} }
} }

Loading…
Cancel
Save