Fix: Null check error in FlowyHoverContainer (#2148)

* fix: fix null check error in FlowyHoverContainer and delete unnecessary widget

* chore: set child to required in FlowyHoverContainer

* chore: delete unused import file
This commit is contained in:
Yijing Huang 2023-03-30 21:10:10 -05:00 committed by GitHub
parent fc004c319b
commit 9fff00f731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 27 deletions

View File

@ -3,7 +3,6 @@ import 'package:flowy_infra/image.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flowy_infra/size.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:easy_localization/easy_localization.dart';
@ -123,7 +122,6 @@ class _AccessoryHoverState extends State<AccessoryHover> {
@override
Widget build(BuildContext context) {
List<Widget> children = [
const _Background(),
Padding(padding: widget.contentPadding, child: widget.child),
];
@ -171,28 +169,6 @@ class AccessoryHoverState extends ChangeNotifier {
bool get onHover => _onHover;
}
class _Background extends StatelessWidget {
const _Background({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Consumer<AccessoryHoverState>(
builder: (context, state, child) {
if (state.onHover) {
return FlowyHoverContainer(
style: HoverStyle(
borderRadius: Corners.s6Border,
hoverColor: AFThemeExtension.of(context).lightGreyHover,
),
);
} else {
return const SizedBox();
}
},
);
}
}
class CellAccessoryContainer extends StatelessWidget {
final List<GridCellAccessoryBuilder> accessories;
const CellAccessoryContainer({required this.accessories, Key? key})

View File

@ -115,11 +115,11 @@ class HoverStyle {
class FlowyHoverContainer extends StatelessWidget {
final HoverStyle style;
final Widget? child;
final Widget child;
const FlowyHoverContainer({
Key? key,
this.child,
required this.child,
required this.style,
}) : super(key: key);
@ -151,7 +151,7 @@ class FlowyHoverContainer extends StatelessWidget {
.iconTheme
.copyWith(color: Theme.of(context).colorScheme.onSurface),
),
child: child!,
child: child,
),
);
}