mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[infra_ui][keyboard] (WIP) Add demo proj for infra ui
This commit is contained in:
parent
a63d5f5eaf
commit
4364f59e39
@ -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);
|
||||
}
|
@ -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.'),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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: ../
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user