Explorar o código

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

Jaylen Bian %!s(int64=3) %!d(string=hai) anos
pai
achega
4364f59e39

+ 17 - 0
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);
+}

+ 43 - 0
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.'),
+          );
+        },
+      ),
+    );
+  }
+}

+ 8 - 0
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
   }
 }

+ 1 - 1
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"

+ 5 - 0
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: ../
 

+ 12 - 0
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();
+  }
+}