selectButton method
Select button. 选择按钮
Implementation
@override
Widget selectButton(BuildContext context) {
return Row(
children: <Widget>[
StreamBuilder<int>(
initialData: currentIndex,
stream: pageStreamController.stream,
builder: (BuildContext _, AsyncSnapshot<int> snapshot) {
return ChangeNotifierProvider<
AssetPickerViewerProvider<AssetEntity>>.value(
value: provider!,
child: Selector<AssetPickerViewerProvider<AssetEntity>,
List<AssetEntity>>(
selector: (
_,
AssetPickerViewerProvider<AssetEntity> p,
) =>
p.currentlySelectedAssets,
builder: (_, List<AssetEntity> currentlySelectedAssets, __) {
final AssetEntity asset =
previewAssets.elementAt(snapshot.data!);
final bool isSelected =
currentlySelectedAssets.contains(asset);
if (isAppleOS) {
return _appleOSSelectButton(isSelected, asset);
}
return _androidSelectButton(isSelected, asset);
},
),
);
},
),
if (!isAppleOS)
Text(
Constants.textDelegate.select,
style: const TextStyle(fontSize: 18.0),
),
],
);
}