chore: update tabbar icon (#5921)

This commit is contained in:
Nathan.fooo 2024-08-10 21:06:54 +08:00 committed by GitHub
parent e2a923a796
commit e87ade6b3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,8 +3,10 @@ import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart';
import 'package:appflowy/workspace/presentation/home/home_sizes.dart'; import 'package:appflowy/workspace/presentation/home/home_sizes.dart';
import 'package:appflowy/workspace/presentation/home/home_stack.dart'; import 'package:appflowy/workspace/presentation/home/home_stack.dart';
import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_infra_ui/style_widget/icon_button.dart'; import 'package:flowy_infra_ui/style_widget/icon_button.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class FlowyTab extends StatefulWidget { class FlowyTab extends StatefulWidget {
@ -26,22 +28,20 @@ class _FlowyTabState extends State<FlowyTab> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return FlowyHover(
onTertiaryTapUp: _closeTab, style: HoverStyle(
child: MouseRegion( borderRadius: BorderRadius.zero,
onEnter: (_) => _setHovering(true), backgroundColor: _getBackgroundColor(),
onExit: (_) => _setHovering(), ),
child: Container( builder: (context, onHover) {
width: HomeSizes.tabBarWidth, return ChangeNotifierProvider.value(
height: HomeSizes.tabBarHeight, value: widget.pageManager.notifier,
decoration: BoxDecoration( child: Consumer<PageNotifier>(
color: _getBackgroundColor(), builder: (context, value, child) => Padding(
), padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: ChangeNotifierProvider.value( child: SizedBox(
value: widget.pageManager.notifier, width: HomeSizes.tabBarWidth,
child: Consumer<PageNotifier>( height: HomeSizes.tabBarHeight,
builder: (context, value, child) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@ -49,15 +49,16 @@ class _FlowyTabState extends State<FlowyTab> {
.tabBarWidget(widget.pageManager.plugin.id), .tabBarWidget(widget.pageManager.plugin.id),
), ),
Visibility( Visibility(
visible: _isHovering, visible: onHover,
child: FlowyIconButton( child: SizedBox(
onPressed: _closeTab, width: 26,
hoverColor: Theme.of(context).hoverColor, height: 26,
iconColorOnHover: child: FlowyIconButton(
Theme.of(context).colorScheme.onSurface, onPressed: _closeTab,
icon: const FlowySvg( icon: const FlowySvg(
FlowySvgs.close_s, FlowySvgs.close_s,
size: Size.fromWidth(16), size: Size.square(22),
),
), ),
), ),
), ),
@ -66,8 +67,8 @@ class _FlowyTabState extends State<FlowyTab> {
), ),
), ),
), ),
), );
), },
); );
} }