mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[flutter]: config create new app button ui
This commit is contained in:
parent
3bd147a058
commit
6d3ee38bec
@ -2,6 +2,7 @@ import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';
|
|||||||
import 'package:app_flowy/workspace/presentation/widgets/dialogs.dart';
|
import 'package:app_flowy/workspace/presentation/widgets/dialogs.dart';
|
||||||
import 'package:flowy_infra/image.dart';
|
import 'package:flowy_infra/image.dart';
|
||||||
import 'package:flowy_infra/size.dart';
|
import 'package:flowy_infra/size.dart';
|
||||||
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
@ -23,21 +24,19 @@ class NewAppButton extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// final theme = context.watch<AppTheme>();
|
// final theme = context.watch<AppTheme>();
|
||||||
|
|
||||||
|
final child = FlowyTextButton(
|
||||||
|
'New App',
|
||||||
|
fontSize: 12,
|
||||||
|
enableHover: false,
|
||||||
|
onPressed: () async => await _showCreateAppDialog(context),
|
||||||
|
heading: svgWithSize("home/new_app", const Size(16, 16)),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: Insets.l, vertical: 20),
|
||||||
|
);
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: HomeSizes.menuAddButtonHeight,
|
height: HomeSizes.menuAddButtonHeight,
|
||||||
child: Row(
|
child: child,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
svgWithSize("home/new_app", const Size(16, 16)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async => await _showCreateAppDialog(context),
|
|
||||||
child: const FlowyText(
|
|
||||||
'New App',
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
).padding(horizontal: Insets.l),
|
|
||||||
).topBorder(color: Colors.grey.shade300);
|
).topBorder(color: Colors.grey.shade300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ class MenuAppHeader extends StatelessWidget {
|
|||||||
HSpace(MenuAppSizes.expandedIconPadding),
|
HSpace(MenuAppSizes.expandedIconPadding),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
onTapDown: (_) {
|
onTapDown: (_) {
|
||||||
ExpandableController.of(context, rebuildOnChange: false, required: true)?.toggle();
|
ExpandableController.of(context, rebuildOnChange: false, required: true)?.toggle();
|
||||||
},
|
},
|
||||||
|
@ -57,33 +57,53 @@ class FlowyTextButton extends StatelessWidget {
|
|||||||
final double fontSize;
|
final double fontSize;
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final EdgeInsets padding;
|
final EdgeInsets padding;
|
||||||
const FlowyTextButton(this.text,
|
final bool enableHover;
|
||||||
{Key? key,
|
final Widget? heading;
|
||||||
this.onPressed,
|
const FlowyTextButton(
|
||||||
this.fontSize = 16,
|
this.text, {
|
||||||
this.padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 6)})
|
Key? key,
|
||||||
: super(key: key);
|
this.onPressed,
|
||||||
|
this.fontSize = 16,
|
||||||
|
this.enableHover = true,
|
||||||
|
this.padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
||||||
|
this.heading,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = context.watch<AppTheme>();
|
final theme = context.watch<AppTheme>();
|
||||||
return InkWell(
|
|
||||||
onTap: onPressed,
|
|
||||||
child: FlowyHover(
|
|
||||||
config: HoverDisplayConfig(borderRadius: BorderRadius.circular(6), hoverColor: theme.bg3),
|
|
||||||
builder: (context, onHover) => _render(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _render() {
|
List<Widget> children = [];
|
||||||
return Padding(
|
if (heading != null) {
|
||||||
|
children.add(heading!);
|
||||||
|
children.add(const HSpace(6));
|
||||||
|
}
|
||||||
|
children.add(FlowyText(text, fontSize: fontSize));
|
||||||
|
|
||||||
|
Widget child = Padding(
|
||||||
padding: padding,
|
padding: padding,
|
||||||
child: Align(
|
child: Expanded(
|
||||||
alignment: Alignment.centerLeft,
|
child: Row(
|
||||||
child: FlowyText(text, fontSize: fontSize),
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: children,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (enableHover) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: onPressed,
|
||||||
|
child: FlowyHover(
|
||||||
|
config: HoverDisplayConfig(borderRadius: BorderRadius.circular(6), hoverColor: theme.bg3),
|
||||||
|
builder: (context, onHover) => child,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return InkWell(
|
||||||
|
onTap: onPressed,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return TextButton(
|
// return TextButton(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user