fix: add support for query schemes in example app (#279)

This commit is contained in:
Mathias Mogensen 2023-07-03 15:03:19 +02:00 • committed by GitHub
commit f6584b9f48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 67 deletions

View file

@ -31,4 +31,11 @@
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
</application> </application>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
</manifest> </manifest>

View file

@ -47,5 +47,9 @@
<true /> <true />
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true /> <true />
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
</array>
</dict> </dict>
</plist> </plist>

View file

@ -61,9 +61,15 @@ class _HomePageState extends State<HomePage> {
void reassemble() { void reassemble() {
super.reassemble(); super.reassemble();
_widgetBuilder = (context) => SimpleEditor(
jsonString: _jsonString,
onEditorStateChange: (editorState) {
_editorState = editorState;
_jsonString = Future.value( _jsonString = Future.value(
jsonEncode(_editorState.document.toJson()), jsonEncode(_editorState.document.toJson()),
); );
},
);
} }
@override @override
@ -74,6 +80,7 @@ class _HomePageState extends State<HomePage> {
drawer: _buildDrawer(context), drawer: _buildDrawer(context),
appBar: AppBar( appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary, backgroundColor: Theme.of(context).colorScheme.inversePrimary,
surfaceTintColor: Colors.transparent,
title: const Text('AppFlowy Editor'), title: const Text('AppFlowy Editor'),
), ),
body: SafeArea(child: _buildBody(context)), body: SafeArea(child: _buildBody(context)),

View file

@ -23,23 +23,8 @@ class MyApp extends StatelessWidget {
], ],
supportedLocales: const [Locale('en', 'US')], supportedLocales: const [Locale('en', 'US')],
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
home: const MyHomePage(title: 'AppFlowyEditor Example'), home: const HomePage(),
theme: ThemeData.light(useMaterial3: true), theme: ThemeData.light(useMaterial3: true),
); );
} }
} }
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return const HomePage();
}
}