2022-09-19 18:12:41 +08:00
|
|
|
import 'package:appflowy_popover/appflowy_popover.dart';
|
2022-08-29 14:00:27 +08:00
|
|
|
import 'package:flutter/material.dart';
|
2024-10-09 15:10:05 +08:00
|
|
|
|
|
|
|
import './example_button.dart';
|
2022-08-29 14:00:27 +08:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
2024-02-19 12:49:55 +07:00
|
|
|
const MyApp({super.key});
|
2022-08-29 14:00:27 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
theme: ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
),
|
|
|
|
home: const MyHomePage(title: 'AppFlowy Popover Example'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyHomePage extends StatefulWidget {
|
2024-02-19 12:49:55 +07:00
|
|
|
const MyHomePage({super.key, required this.title});
|
2022-08-29 14:00:27 +08:00
|
|
|
|
|
|
|
final String title;
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(widget.title),
|
|
|
|
),
|
2024-10-09 15:10:05 +08:00
|
|
|
body: const Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 48.0, vertical: 24.0),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
ExampleButton(
|
|
|
|
label: 'Left top',
|
|
|
|
offset: Offset(0, 10),
|
|
|
|
direction: PopoverDirection.bottomWithLeftAligned,
|
|
|
|
),
|
|
|
|
ExampleButton(
|
|
|
|
label: 'Left Center',
|
|
|
|
offset: Offset(0, -10),
|
|
|
|
direction: PopoverDirection.rightWithCenterAligned,
|
|
|
|
),
|
|
|
|
ExampleButton(
|
|
|
|
label: 'Left bottom',
|
|
|
|
offset: Offset(0, -10),
|
|
|
|
direction: PopoverDirection.topWithLeftAligned,
|
|
|
|
),
|
|
|
|
],
|
2024-01-25 16:37:36 +01:00
|
|
|
),
|
2024-10-09 15:10:05 +08:00
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
2024-01-25 16:37:36 +01:00
|
|
|
children: [
|
|
|
|
ExampleButton(
|
2024-10-09 15:10:05 +08:00
|
|
|
label: 'Top',
|
2024-01-25 16:37:36 +01:00
|
|
|
offset: Offset(0, 10),
|
|
|
|
direction: PopoverDirection.bottomWithCenterAligned,
|
|
|
|
),
|
2024-10-09 15:10:05 +08:00
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
ExampleButton(
|
|
|
|
label: 'Central',
|
|
|
|
offset: Offset(0, 10),
|
|
|
|
direction: PopoverDirection.bottomWithCenterAligned,
|
|
|
|
),
|
|
|
|
],
|
2024-01-25 16:37:36 +01:00
|
|
|
),
|
|
|
|
ExampleButton(
|
2024-10-09 15:10:05 +08:00
|
|
|
label: 'Bottom',
|
2024-01-25 16:37:36 +01:00
|
|
|
offset: Offset(0, -10),
|
|
|
|
direction: PopoverDirection.topWithCenterAligned,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2024-10-09 15:10:05 +08:00
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
ExampleButton(
|
|
|
|
label: 'Right top',
|
|
|
|
offset: Offset(0, 10),
|
|
|
|
direction: PopoverDirection.bottomWithRightAligned,
|
|
|
|
),
|
|
|
|
ExampleButton(
|
|
|
|
label: 'Right Center',
|
|
|
|
offset: Offset(0, 10),
|
|
|
|
direction: PopoverDirection.leftWithCenterAligned,
|
|
|
|
),
|
|
|
|
ExampleButton(
|
|
|
|
label: 'Right bottom',
|
|
|
|
offset: Offset(0, -10),
|
|
|
|
direction: PopoverDirection.topWithRightAligned,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2024-01-25 16:37:36 +01:00
|
|
|
),
|
2022-08-29 14:00:27 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|