Skip to content

Commit

Permalink
fix: Fixed templates for tab and navigation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Dec 15, 2023
1 parent f3de01f commit 3b0c2bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 6 additions & 5 deletions packages/katana_cli/lib/command/code/tmp/navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ enum ${className}PageNavigation {
/// The first navigation to display.
// TODO: Specify the initial navigation.
static final ${className}PageTab initialNavigation = ${className}PageNavigation.navigation1;
static const ${className}PageNavigation initialNavigation = ${className}PageNavigation.navigation1;
/// Get the label of ${className}PageNavigation.
// TODO: Specify a label for each navigation.
Expand Down Expand Up @@ -173,9 +173,11 @@ class ${className}Page extends PageScopedWidget {
currentIndex: nestedRouter.currentQuery?.key<${className}PageNavigation>()?.index ??
${className}PageNavigation.initialNavigation.index,
onTap: (index) {
nestedRouter.push(
${className}PageNavigation.values[index].routeQuery,
);
final routeQuery = TestPageNavigation.values[index].routeQuery;
if (routeQuery == null) {
return;
}
nestedRouter.push(routeQuery);
},
items: [
...${className}PageNavigation.values.map((e) {
Expand All @@ -187,7 +189,6 @@ class ${className}Page extends PageScopedWidget {
],
),
);
);
}
}
""";
Expand Down
9 changes: 7 additions & 2 deletions packages/katana_cli/lib/command/code/tmp/tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ enum ${className}PageTab {
/// The first tab to display.
// TODO: Specify the initial tab.
static final ${className}PageTab initialTab = ${className}PageTab.tab1;
static const ${className}PageTab initialTab = ${className}PageTab.tab1;
/// Get the label of ${className}PageTab.
// TODO: Specify a label for each tab.
Expand Down Expand Up @@ -164,7 +164,12 @@ class ${className}Page extends PageScopedWidget {
return DefaultTabController(
initialIndex: ${className}PageTab.initialTab.index,
length: ${className}PageTab.values.length,
child: UniversalScaffold(),
child: UniversalScaffold(
appBar: UniversalAppBar(
bottom: tabBar,
),
body: tabView,
),
);
}
}
Expand Down

0 comments on commit 3b0c2bb

Please sign in to comment.