opt: common ctr

opt: state

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-11 12:21:42 +08:00
parent 5bff1747e6
commit 574bf861f0
129 changed files with 1065 additions and 1058 deletions

View File

@@ -46,13 +46,13 @@ class _LiveEmotePanelState extends State<LiveEmotePanel>
Widget _buildBody(LoadingState<List<LiveEmoteDatum>?> loadingState) {
return switch (loadingState) {
Loading() => loadingWidget,
Success() => loadingState.response?.isNotEmpty == true
Success(:var response) => response?.isNotEmpty == true
? Column(
children: [
Expanded(
child: tabBarView(
controller: _emotePanelController.tabController,
children: loadingState.response!.map(
children: response!.map(
(item) {
if (item.emoticons.isNullOrEmpty) {
return const SizedBox.shrink();
@@ -116,7 +116,7 @@ class _LiveEmotePanelState extends State<LiveEmotePanel>
dividerColor: Colors.transparent,
dividerHeight: 0,
isScrollable: true,
tabs: loadingState.response!
tabs: response
.map(
(item) => Padding(
padding: const EdgeInsets.all(8),
@@ -134,7 +134,7 @@ class _LiveEmotePanelState extends State<LiveEmotePanel>
],
)
: _errorWidget(),
Error() => _errorWidget(loadingState.errMsg),
Error(:var errMsg) => _errorWidget(errMsg),
};
}