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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
[flutter]: config create new app button ui
appflowy6d3ee38bec9c
diff --git a/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/create_button.dart b/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/create_button.dartindex 1bf14e7b3d..dfbc28e4f0 100644--- a/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/create_button.dart+++ b/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/create_button.dart@@ -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:flowy_infra/image.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:flutter/material.dart';import 'package:styled_widget/styled_widget.dart';@@ -23,21 +24,19 @@ class NewAppButton extends StatelessWidget {@overrideWidget build(BuildContext context) {// 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(height: HomeSizes.menuAddButtonHeight,- child: Row(- 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),+ child: child,).topBorder(color: Colors.grey.shade300);}diff --git a/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header.dart b/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header.dartindex e0cf7f619f..e612e08e67 100644--- a/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header.dart+++ b/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header.dart@@ -51,6 +51,7 @@ class MenuAppHeader extends StatelessWidget {HSpace(MenuAppSizes.expandedIconPadding),Expanded(child: GestureDetector(+ behavior: HitTestBehavior.opaque,onTapDown: (_) {ExpandableController.of(context, rebuildOnChange: false, required: true)?.toggle();},diff --git a/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dart b/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dartindex 6588cdb93c..96b4dd910c 100644--- a/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dart+++ b/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dart@@ -57,33 +57,53 @@ class FlowyTextButton extends StatelessWidget {final double fontSize;final VoidCallback? onPressed;final EdgeInsets padding;- const FlowyTextButton(this.text,- {Key? key,- this.onPressed,- this.fontSize = 16,- this.padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 6)})- : super(key: key);+ final bool enableHover;+ final Widget? heading;+ const FlowyTextButton(+ this.text, {+ Key? key,+ this.onPressed,+ this.fontSize = 16,+ this.enableHover = true,+ this.padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 6),+ this.heading,+ }) : super(key: key);@overrideWidget build(BuildContext context) {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() {- return Padding(+ List<Widget> children = [];+ if (heading != null) {+ children.add(heading!);+ children.add(const HSpace(6));+ }+ children.add(FlowyText(text, fontSize: fontSize));++ Widget child = Padding(padding: padding,- child: Align(- alignment: Alignment.centerLeft,- child: FlowyText(text, fontSize: fontSize),+ child: Expanded(+ child: Row(+ 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(