Skip to content

Commit

Permalink
Merge pull request #48 from koji-1009/feature/navigation_rail_extended
Browse files Browse the repository at this point in the history
Use NavigationRail extended mode
  • Loading branch information
koji-1009 authored Jun 24, 2023
2 parents 3949ccc + 5aa2de5 commit a3adffb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ linter:
require_trailing_commas: true
avoid_void_async: true
unawaited_futures: true
unnecessary_breaks: true

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
18 changes: 6 additions & 12 deletions lib/view/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class HomeScreen extends ConsumerWidget {
switch (mode) {
case HomeMode.simple:
actionButton = null;
break;
case HomeMode.full:
actionButton = FloatingActionButton.extended(
label: const Text('検索'),
Expand Down Expand Up @@ -81,24 +80,19 @@ class HomeScreen extends ConsumerWidget {
SearchMeetingDetailRoute(
q: state.fullParams.uriQuery,
).push(context);
break;
case SearchMode.meetingSummary:
SearchMeetingSummaryRoute(
q: state.fullParams.uriQuery,
).push(context);
break;
case SearchMode.speech:
SearchSpeechRoute(
q: state.fullParams.uriQuery,
).push(context);
break;
}
},
);
break;
case HomeMode.history:
actionButton = null;
break;
}

if (screenSize == BreakpointScreenSize.compact) {
Expand Down Expand Up @@ -141,6 +135,7 @@ class HomeScreen extends ConsumerWidget {
);
}

final isExtended = screenSize == BreakpointScreenSize.expanded;
return Scaffold(
appBar: AppBar(
title: const Text('議事録検索'),
Expand All @@ -151,18 +146,20 @@ class HomeScreen extends ConsumerWidget {
body: Row(
children: [
NavigationRail(
extended: isExtended,
labelType: isExtended ? null : NavigationRailLabelType.selected,
destinations: const [
NavigationRailDestination(
icon: Icon(Icons.search),
label: Text('キーワード検索'),
label: Text('キーワード'),
),
NavigationRailDestination(
icon: Icon(Icons.manage_search),
label: Text('条件検索'),
label: Text('条件'),
),
NavigationRailDestination(
icon: Icon(Icons.history),
label: Text('検索履歴'),
label: Text('検索'),
),
],
selectedIndex: index,
Expand Down Expand Up @@ -191,13 +188,10 @@ class HomeScreen extends ConsumerWidget {
switch (mode) {
case HomeMode.simple:
const SimpleRoute().go(context);
break;
case HomeMode.full:
const FullRoute().go(context);
break;
case HomeMode.history:
const HistoryRoute().go(context);
break;
}
}
}
4 changes: 0 additions & 4 deletions lib/view/widget/home_app_bar_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,10 @@ class HomeAppBarAction extends StatelessWidget {
context: context,
builder: (context) => const CacheClearDialog(),
);
break;
case _HomeAction.github:
await launchUrlString(_repositoryUrl);
break;
case _HomeAction.ndl:
await launchUrlString(_ndlApiDocUrl);
break;
case _HomeAction.about:
final body = [
const Text(
Expand Down Expand Up @@ -89,7 +86,6 @@ class HomeAppBarAction extends StatelessWidget {
context: context,
children: body,
);
break;
}
},
);
Expand Down

0 comments on commit a3adffb

Please sign in to comment.