pathEntitySelector method
Path entity select widget builder. 路径选择部件构建
Implementation
@override
Widget pathEntitySelector(BuildContext context) {
return UnconstrainedBox(
child: GestureDetector(
onTap: () => provider.isSwitchingPath = !provider.isSwitchingPath,
child: Container(
height: appBarItemHeight,
constraints: BoxConstraints(maxWidth: Screens.width * 0.5),
padding: const EdgeInsetsDirectional.only(start: 12.0, end: 6.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(999),
color: theme.dividerColor,
),
child: Selector<DefaultAssetPickerProvider, AssetPathEntity?>(
selector: (_, DefaultAssetPickerProvider p) => p.currentPathEntity,
builder: (_, AssetPathEntity? p, Widget? w) => Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
if (p != null)
Flexible(
child: Text(
p.name,
style: const TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.normal,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
w!,
],
),
child: Padding(
padding: const EdgeInsetsDirectional.only(start: 5.0),
child: DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.iconTheme.color!.withOpacity(0.5),
),
child: Selector<DefaultAssetPickerProvider, bool>(
selector: (_, DefaultAssetPickerProvider p) =>
p.isSwitchingPath,
builder: (_, bool isSwitchingPath, Widget? w) =>
Transform.rotate(
angle: isSwitchingPath ? math.pi : 0.0,
alignment: Alignment.center,
child: w,
),
child: Icon(
Icons.keyboard_arrow_down,
size: 20.0,
color: theme.colorScheme.primary,
),
),
),
),
),
),
),
);
}