feat: add more showcases on desktop/mobile platform (#481)
This commit is contained in:
parent
6699d58631
commit
78dd254d1e
1 changed files with 1187 additions and 434 deletions
|
|
@ -51,7 +51,9 @@ class _HomePageState extends State<HomePage> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_jsonString = rootBundle.loadString('assets/example.json');
|
||||
_jsonString = PlatformExtension.isDesktopOrWeb
|
||||
? rootBundle.loadString('assets/example.json')
|
||||
: rootBundle.loadString('assets/mobile_example.json');
|
||||
|
||||
_widgetBuilder = (context) => Editor(
|
||||
jsonString: _jsonString,
|
||||
|
|
@ -109,7 +111,9 @@ class _HomePageState extends State<HomePage> {
|
|||
// AppFlowy Editor Demo
|
||||
_buildSeparator(context, 'AppFlowy Editor Demo'),
|
||||
_buildListTile(context, 'With Example.json', () {
|
||||
final jsonString = rootBundle.loadString('assets/example.json');
|
||||
final jsonString = PlatformExtension.isDesktopOrWeb
|
||||
? rootBundle.loadString('assets/example.json')
|
||||
: rootBundle.loadString('assets/mobile_example.json');
|
||||
_loadEditor(context, jsonString);
|
||||
}),
|
||||
_buildListTile(context, 'With Large Document (10000+ lines)', () {
|
||||
|
|
@ -159,6 +163,16 @@ class _HomePageState extends State<HomePage> {
|
|||
),
|
||||
);
|
||||
}),
|
||||
_buildListTile(context, 'RTL', () {
|
||||
final jsonString = rootBundle.loadString(
|
||||
'assets/arabic_example.json',
|
||||
);
|
||||
_loadEditor(
|
||||
context,
|
||||
jsonString,
|
||||
textDirection: TextDirection.rtl,
|
||||
);
|
||||
}),
|
||||
|
||||
// Encoder Demo
|
||||
_buildSeparator(context, 'Export To X Demo'),
|
||||
|
|
@ -227,8 +241,9 @@ class _HomePageState extends State<HomePage> {
|
|||
|
||||
Future<void> _loadEditor(
|
||||
BuildContext context,
|
||||
Future<String> jsonString,
|
||||
) async {
|
||||
Future<String> jsonString, {
|
||||
TextDirection textDirection = TextDirection.ltr,
|
||||
}) async {
|
||||
final completer = Completer<void>();
|
||||
_jsonString = jsonString;
|
||||
setState(
|
||||
|
|
@ -238,6 +253,7 @@ class _HomePageState extends State<HomePage> {
|
|||
onEditorStateChange: (editorState) {
|
||||
_editorState = editorState;
|
||||
},
|
||||
textDirection: textDirection,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue