-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'AppFlowy-IO:main' into link-menu-overflow-fix
- Loading branch information
Showing
30 changed files
with
245 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
buildscript { | ||
ext.kotlin_version = '1.6.10' | ||
ext.kotlin_version = '1.8.0' | ||
repositories { | ||
google() | ||
mavenCentral() | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>Example</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>example</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(FLUTTER_BUILD_NAME)</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(FLUTTER_BUILD_NUMBER)</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true /> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UIViewControllerBasedStatusBarAppearance</key> | ||
<false /> | ||
<key>CADisableMinimumFrameDurationOnPhone</key> | ||
<true /> | ||
<key>UIApplicationSupportsIndirectInputEvents</key> | ||
<true /> | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>https</string> | ||
</array> | ||
</dict> | ||
</plist> | ||
<dict> | ||
<key>CADisableMinimumFrameDurationOnPhone</key> | ||
<true/> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>Example</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>example</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(FLUTTER_BUILD_NAME)</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(FLUTTER_BUILD_NUMBER)</string> | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>https</string> | ||
</array> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIApplicationSupportsIndirectInputEvents</key> | ||
<true/> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UIViewControllerBasedStatusBarAppearance</key> | ||
<false/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
import 'package:appflowy_editor/appflowy_editor.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:google_fonts/google_fonts.dart'; | ||
|
||
class MobileEditor extends StatefulWidget { | ||
const MobileEditor({ | ||
super.key, | ||
required this.editorState, | ||
required this.onEditorStateChange, | ||
this.editorStyle, | ||
}); | ||
|
||
final EditorState editorState; | ||
final EditorStyle? editorStyle; | ||
final void Function(EditorState editorState) onEditorStateChange; | ||
|
||
@override | ||
State<MobileEditor> createState() => _MobileEditorState(); | ||
} | ||
|
||
class _MobileEditorState extends State<MobileEditor> { | ||
EditorState get editorState => widget.editorState; | ||
|
||
late final EditorScrollController editorScrollController; | ||
|
||
late EditorStyle editorStyle; | ||
late Map<String, BlockComponentBuilder> blockComponentBuilders; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
// customize the log configuration | ||
editorState.logConfiguration | ||
..handler = debugPrint | ||
..level = LogLevel.off; | ||
|
||
// listen to editor state change | ||
editorState.transactionStream.listen((event) { | ||
if (event.$1 == TransactionTime.after) { | ||
widget.onEditorStateChange(editorState); | ||
} | ||
}); | ||
|
||
editorScrollController = EditorScrollController( | ||
editorState: editorState, | ||
shrinkWrap: false, | ||
); | ||
|
||
editorStyle = _buildMobileEditorStyle(); | ||
blockComponentBuilders = _buildBlockComponentBuilders(); | ||
} | ||
|
||
@override | ||
void reassemble() { | ||
super.reassemble(); | ||
|
||
editorStyle = _buildMobileEditorStyle(); | ||
blockComponentBuilders = _buildBlockComponentBuilders(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: [ | ||
// build appflowy editor | ||
Expanded( | ||
child: AppFlowyEditor( | ||
editorStyle: editorStyle, | ||
editorState: editorState, | ||
editorScrollController: editorScrollController, | ||
blockComponentBuilders: blockComponentBuilders, | ||
// showcase 3: customize the header and footer. | ||
header: Image.asset( | ||
'assets/images/icon.jpeg', | ||
fit: BoxFit.fitWidth, | ||
height: 100, | ||
), | ||
footer: const SizedBox( | ||
height: 100, | ||
), | ||
), | ||
), | ||
// build mobile toolbar | ||
MobileToolbar( | ||
editorState: editorState, | ||
toolbarItems: [ | ||
textDecorationMobileToolbarItem, | ||
buildTextAndBackgroundColorMobileToolbarItem(), | ||
headingMobileToolbarItem, | ||
todoListMobileToolbarItem, | ||
listMobileToolbarItem, | ||
linkMobileToolbarItem, | ||
quoteMobileToolbarItem, | ||
dividerMobileToolbarItem, | ||
codeMobileToolbarItem, | ||
], | ||
), | ||
], | ||
); | ||
} | ||
|
||
// showcase 1: customize the editor style. | ||
EditorStyle _buildMobileEditorStyle() { | ||
return EditorStyle.mobile( | ||
cursorColor: Colors.blue, | ||
selectionColor: Colors.blue.shade200, | ||
textStyleConfiguration: TextStyleConfiguration( | ||
text: GoogleFonts.poppins( | ||
fontSize: 14, | ||
color: Colors.black, | ||
), | ||
code: GoogleFonts.badScript(), | ||
), | ||
padding: const EdgeInsets.symmetric(horizontal: 14.0), | ||
); | ||
} | ||
|
||
// showcase 2: customize the block style | ||
Map<String, BlockComponentBuilder> _buildBlockComponentBuilders() { | ||
final map = { | ||
...standardBlockComponentBuilderMap, | ||
}; | ||
// customize the heading block component | ||
final levelToFontSize = [ | ||
24.0, | ||
22.0, | ||
20.0, | ||
18.0, | ||
16.0, | ||
14.0, | ||
]; | ||
map[HeadingBlockKeys.type] = HeadingBlockComponentBuilder( | ||
textStyleBuilder: (level) => GoogleFonts.poppins( | ||
fontSize: levelToFontSize.elementAtOrNull(level - 1) ?? 14.0, | ||
fontWeight: FontWeight.w600, | ||
), | ||
); | ||
return map; | ||
} | ||
} |
Oops, something went wrong.