appBar method
AppBar widget. 顶栏部件
Implementation
Widget appBar(BuildContext context) {
final bar = AssetPickerAppBar(
leading: Semantics(
sortKey: ordinalSortKey(0),
child: IconButton(
onPressed: () {
Navigator.maybeOf(context)?.maybePop();
},
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
icon: Icon(
Icons.arrow_back_ios_new,
semanticLabel: MaterialLocalizations.of(context).backButtonTooltip,
),
),
),
centerTitle: true,
title: specialPickerType == null
? Semantics(
sortKey: ordinalSortKey(0.1),
child: StreamBuilder<int>(
initialData: currentIndex,
stream: pageStreamController.stream,
builder: (_, AsyncSnapshot<int> snapshot) => ScaleText(
'${snapshot.requireData + 1}/${previewAssets.length}',
style: const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w500,
),
),
),
)
: null,
actions: [
if (provider != null)
Semantics(
sortKey: ordinalSortKey(0.2),
child: selectButton(context),
),
const SizedBox(width: 14),
],
);
return ValueListenableBuilder(
valueListenable: isDisplayingDetail,
builder: (_, v, child) => AnimatedPositionedDirectional(
duration: kThemeAnimationDuration,
curve: Curves.easeInOut,
top: v ? 0.0 : -(context.topPadding + bar.preferredSize.height),
start: 0.0,
end: 0.0,
child: child!,
),
child: bar,
);
}