Update the example

pull/1489/head^2
Ellet 1 year ago
parent 85207174ce
commit bd78a9b215
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 3
      example/android/app/src/main/AndroidManifest.xml
  2. 5
      example/lib/presentation/quill/quill_screen.dart
  3. 14
      example/lib/presentation/quill/quill_toolbar.dart
  4. 4
      lib/src/models/config/toolbar/configurations.dart
  5. 3
      lib/src/utils/platform.dart

@ -5,7 +5,8 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" /> android:maxSdkVersion="32"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- The camera and gps features will be used --> <!-- The camera and gps features will be used -->

@ -115,7 +115,10 @@ class _QuillScreenState extends State<QuillScreen> {
), ),
child: Column( child: Column(
children: [ children: [
if (!_isReadOnly) const MyQuillToolbar(), if (!_isReadOnly)
MyQuillToolbar(
focusNode: _editorFocusNode,
),
Builder( Builder(
builder: (context) { builder: (context) {
return Expanded( return Expanded(

@ -15,7 +15,12 @@ import '../settings/cubit/settings_cubit.dart';
import 'embeds/timestamp_embed.dart'; import 'embeds/timestamp_embed.dart';
class MyQuillToolbar extends StatelessWidget { class MyQuillToolbar extends StatelessWidget {
const MyQuillToolbar({super.key}); const MyQuillToolbar({
required this.focusNode,
super.key,
});
final FocusNode focusNode;
Future<void> onImageInsertWithCropping( Future<void> onImageInsertWithCropping(
String image, String image,
@ -211,6 +216,13 @@ class MyQuillToolbar extends StatelessWidget {
} }
return QuillToolbar( return QuillToolbar(
configurations: QuillToolbarConfigurations( configurations: QuillToolbarConfigurations(
showAlignmentButtons: true,
buttonOptions: QuillToolbarButtonOptions(
base: QuillToolbarBaseButtonOptions(
// Request editor focus when any button is pressed
afterButtonPressed: focusNode.requestFocus,
),
),
customButtons: [ customButtons: [
QuillToolbarCustomButtonOptions( QuillToolbarCustomButtonOptions(
icon: const Icon(Icons.add_alarm_rounded), icon: const Icon(Icons.add_alarm_rounded),

@ -154,7 +154,7 @@ class QuillToolbarConfigurations extends Equatable {
/// 'Nunito': 'nunito', /// 'Nunito': 'nunito',
/// 'Pacifico': 'pacifico', /// 'Pacifico': 'pacifico',
/// 'Roboto Mono': 'roboto-mono', /// 'Roboto Mono': 'roboto-mono',
/// 'Clear'.i18n: 'Clear' /// 'Clear'.loc: 'Clear'
/// }; /// };
/// ``` /// ```
final Map<String, String>? fontFamilyValues; final Map<String, String>? fontFamilyValues;
@ -165,7 +165,7 @@ class QuillToolbarConfigurations extends Equatable {
/// 'Small'.i18n: 'small', /// 'Small'.i18n: 'small',
/// 'Large'.i18n: 'large', /// 'Large'.i18n: 'large',
/// 'Huge'.i18n: 'huge', /// 'Huge'.i18n: 'huge',
/// 'Clear'.i18n: '0' /// 'Clear'.loc: '0'
/// } /// }
/// ``` /// ```
final Map<String, String>? fontSizesValues; final Map<String, String>? fontSizesValues;

@ -4,7 +4,8 @@ import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart' import 'package:flutter/foundation.dart'
show TargetPlatform, defaultTargetPlatform, kIsWeb, visibleForTesting; show TargetPlatform, defaultTargetPlatform, kIsWeb, visibleForTesting;
/// If you want to override the [kIsWeb] use [overrideIsWeb] /// If you want to override the [kIsWeb] use [overrideIsWeb] but it's only
/// for testing
bool isWeb({ bool isWeb({
@visibleForTesting bool? overrideIsWeb, @visibleForTesting bool? overrideIsWeb,
}) { }) {

Loading…
Cancel
Save