-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
161 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:yaru_widgets/src/pages/layouts/yaru_page_item.dart'; | ||
|
||
class YaruNavigationRail extends StatelessWidget { | ||
const YaruNavigationRail({ | ||
super.key, | ||
required this.destinations, | ||
required this.selectedIndex, | ||
required this.onDestinationSelected, | ||
this.showLabels = false, | ||
this.extended = false, | ||
}); | ||
|
||
final List<YaruPageItem> destinations; | ||
final int selectedIndex; | ||
final ValueChanged<int> onDestinationSelected; | ||
final bool showLabels; | ||
final bool extended; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: <Widget>[ | ||
for (int i = 0; i < destinations.length; i += 1) | ||
_YaruNavigationRailItem( | ||
i, | ||
i == selectedIndex, | ||
destinations[i], | ||
onDestinationSelected, | ||
showLabels, | ||
) | ||
], | ||
); | ||
} | ||
} | ||
|
||
class _YaruNavigationRailItem extends StatelessWidget { | ||
const _YaruNavigationRailItem( | ||
this.index, | ||
this.selected, | ||
this.destination, | ||
this.onSelected, | ||
this.showLabel, | ||
); | ||
|
||
final int index; | ||
final bool selected; | ||
final YaruPageItem destination; | ||
final ValueChanged<int> onSelected; | ||
final bool showLabel; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
width: showLabel ? 85 : 60, | ||
child: Material( | ||
child: InkWell( | ||
onTap: () => onSelected(index), | ||
child: Center( | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 7, horizontal: 5), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(100), | ||
color: selected | ||
? Theme.of(context) | ||
.colorScheme | ||
.onSurface | ||
.withOpacity(.1) | ||
: null, | ||
), | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric( | ||
vertical: 2, | ||
horizontal: 10, | ||
), | ||
child: Icon(destination.iconData), | ||
), | ||
), | ||
if (showLabel) ...[ | ||
const SizedBox(height: 2), | ||
destination.titleBuilder(context), | ||
] | ||
], | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/home/jupiter007/.pub-cache/hosted/pub.dartlang.org/yaru-0.4.1/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Generated file. Do not edit. | ||
// | ||
|
||
// clang-format off | ||
|
||
#include "generated_plugin_registrant.h" | ||
|
||
#include <yaru/yaru_plugin.h> | ||
|
||
void fl_register_plugins(FlPluginRegistry* registry) { | ||
g_autoptr(FlPluginRegistrar) yaru_registrar = | ||
fl_plugin_registry_get_registrar_for_plugin(registry, "YaruPlugin"); | ||
yaru_plugin_register_with_registrar(yaru_registrar); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Generated file. Do not edit. | ||
// | ||
|
||
// clang-format off | ||
|
||
#ifndef GENERATED_PLUGIN_REGISTRANT_ | ||
#define GENERATED_PLUGIN_REGISTRANT_ | ||
|
||
#include <flutter_linux/flutter_linux.h> | ||
|
||
// Registers Flutter plugins. | ||
void fl_register_plugins(FlPluginRegistry* registry); | ||
|
||
#endif // GENERATED_PLUGIN_REGISTRANT_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Generated file, do not edit. | ||
# | ||
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
yaru | ||
) | ||
|
||
list(APPEND FLUTTER_FFI_PLUGIN_LIST | ||
) | ||
|
||
set(PLUGIN_BUNDLED_LIBRARIES) | ||
|
||
foreach(plugin ${FLUTTER_PLUGIN_LIST}) | ||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) | ||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) | ||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) | ||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) | ||
endforeach(plugin) | ||
|
||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) | ||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) | ||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) | ||
endforeach(ffi_plugin) |