Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

[infra_ui][keyboard] (WIP) Add demo proj for infra ui

Jaylen Bian4364f59e39f6
diff --git a/app_flowy/packages/flowy_infra_ui/example/lib/home/demo_item.dart b/app_flowy/packages/flowy_infra_ui/example/lib/home/demo_item.dart
new file mode 100644
index 0000000000..da6051f1c7
--- /dev/null
+++ b/app_flowy/packages/flowy_infra_ui/example/lib/home/demo_item.dart
@@ -0,0 +1,17 @@
+import 'package:flutter/material.dart';
+
+abstract class ListItem {}
+
+abstract class DemoItem extends ListItem {
+ String buildTitle();
+
+ void handleTap();
+}
+
+class SectionHeaderItem extends ListItem {
+ SectionHeaderItem(this.title);
+
+ final String title;
+
+ Widget buildWidget(BuildContext context) => Text(title);
+}
diff --git a/app_flowy/packages/flowy_infra_ui/example/lib/home/home_screen.dart b/app_flowy/packages/flowy_infra_ui/example/lib/home/home_screen.dart
new file mode 100644
index 0000000000..7f0ca3fb6b
--- /dev/null
+++ b/app_flowy/packages/flowy_infra_ui/example/lib/home/home_screen.dart
@@ -0,0 +1,43 @@
+import 'package:example/home/demo_item.dart';
+import 'package:flutter/material.dart';
+
+class HomeScreen extends StatelessWidget {
+ const HomeScreen({Key? key}) : super(key: key);
+
+ static List<ListItem> items = [
+ SectionHeaderItem('Widget Demos'),
+ ];
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text('Demos'),
+ ),
+ body: ListView.builder(
+ itemCount: items.length,
+ itemBuilder: (context, index) {
+ final item = items[index];
+ if (item is SectionHeaderItem) {
+ return Container(
+ constraints: const BoxConstraints(maxHeight: 48.0),
+ color: Colors.grey[300],
+ alignment: Alignment.center,
+ child: ListTile(
+ title: Text(item.title),
+ ),
+ );
+ } else if (item is DemoItem) {
+ return ListTile(
+ title: Text(item.buildTitle()),
+ onTap: item.handleTap,
+ );
+ }
+ return const ListTile(
+ title: Text('Unknow.'),
+ );
+ },
+ ),
+ );
+ }
+}
diff --git a/app_flowy/packages/flowy_infra_ui/example/lib/main.dart b/app_flowy/packages/flowy_infra_ui/example/lib/main.dart
index 9cc621647d..fcaec37764 100644
--- a/app_flowy/packages/flowy_infra_ui/example/lib/main.dart
+++ b/app_flowy/packages/flowy_infra_ui/example/lib/main.dart
@@ -1,3 +1,4 @@
+import 'package:example/home/home_screen.dart';
import 'package:flutter/material.dart';
void main() {
@@ -9,6 +10,13 @@ class ExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
+<<<<<<< HEAD
return const MaterialApp();
+=======
+ return const MaterialApp(
+ title: "Flowy Infra Title",
+ home: HomeScreen(),
+ );
+>>>>>>> [infra_ui][keyboard] (WIP) Add demo proj for infra ui
}
}
diff --git a/app_flowy/packages/flowy_infra_ui/example/pubspec.lock b/app_flowy/packages/flowy_infra_ui/example/pubspec.lock
index 999a86c0e7..bf24d5be0c 100644
--- a/app_flowy/packages/flowy_infra_ui/example/pubspec.lock
+++ b/app_flowy/packages/flowy_infra_ui/example/pubspec.lock
@@ -178,7 +178,7 @@ packages:
source: hosted
version: "1.8.0"
provider:
- dependency: transitive
+ dependency: "direct main"
description:
name: provider
url: "https://pub.dartlang.org"
diff --git a/app_flowy/packages/flowy_infra_ui/example/pubspec.yaml b/app_flowy/packages/flowy_infra_ui/example/pubspec.yaml
index 901200091e..09ad328ffb 100644
--- a/app_flowy/packages/flowy_infra_ui/example/pubspec.yaml
+++ b/app_flowy/packages/flowy_infra_ui/example/pubspec.yaml
@@ -10,6 +10,11 @@ dependencies:
flutter:
sdk: flutter
+<<<<<<< HEAD
+=======
+ cupertino_icons: ^1.0.2
+ provider: ^5.0.0
+>>>>>>> [infra_ui][keyboard] (WIP) Add demo proj for infra ui
flowy_infra_ui:
path: ../
diff --git a/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_widget.dart b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_widget.dart
new file mode 100644
index 0000000000..543818fc5c
--- /dev/null
+++ b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_widget.dart
@@ -0,0 +1,12 @@
+import 'package:flutter/material.dart';
+
+class Overlay extends StatelessWidget {
+ const Overlay({Key? key}) : super(key: key);
+
+ final bool safeAreaEnabled;
+
+ @override
+ Widget build(BuildContext context) {
+ return Container();
+ }
+}