Show shared resize grips on list pane dividers
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'host.dart';
|
||||
|
||||
/// A native-themed affordance for a draggable pane divider.
|
||||
class AdaptiveResizeGrip extends StatelessWidget {
|
||||
const AdaptiveResizeGrip({
|
||||
super.key,
|
||||
this.axis = Axis.horizontal,
|
||||
this.emphasized = false,
|
||||
this.compact = false,
|
||||
});
|
||||
|
||||
final Axis axis;
|
||||
final bool emphasized;
|
||||
final bool compact;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return RotatedBox(
|
||||
quarterTurns: axis == Axis.vertical ? 1 : 0,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondarySystemBackground.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: emphasized
|
||||
? Border.all(
|
||||
color: cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: compact ? 6 : 8),
|
||||
child: Icon(
|
||||
cupertino ? CupertinoIcons.minus : Icons.drag_handle,
|
||||
size: compact ? 12 : 18,
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user