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

@@ -58,10 +58,10 @@ class _LiveAreaDetailPageState extends State<LiveAreaDetailPage> {
ThemeData theme, LoadingState<List<AreaItem>?> loadingState) {
return switch (loadingState) {
Loading() => const SizedBox.shrink(),
Success() => loadingState.response?.isNotEmpty == true
Success(:var response) => response?.isNotEmpty == true
? DefaultTabController(
initialIndex: _controller.initialIndex,
length: loadingState.response!.length,
length: response!.length,
child: Builder(
builder: (context) {
return Column(
@@ -75,7 +75,7 @@ class _LiveAreaDetailPageState extends State<LiveAreaDetailPage> {
dividerColor: Colors.transparent,
isScrollable: true,
tabAlignment: TabAlignment.start,
tabs: loadingState.response!
tabs: response
.map((e) => Tab(text: e.name ?? ''))
.toList(),
),
@@ -85,7 +85,7 @@ class _LiveAreaDetailPageState extends State<LiveAreaDetailPage> {
icon: Icons.menu,
bgColor: Colors.transparent,
onPressed: () {
_showTags(context, theme, loadingState.response!);
_showTags(context, theme, response);
},
),
],
@@ -93,7 +93,7 @@ class _LiveAreaDetailPageState extends State<LiveAreaDetailPage> {
const Divider(height: 1),
Expanded(
child: tabBarView(
children: loadingState.response!
children: response
.map((e) => LiveAreaChildPage(
areaId: e.id,
parentAreaId: e.parentId,