Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 42 additions & 9 deletions open_wearable/lib/widgets/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const int _sensorsIndex = 2;
const int _sectionCount = 5;

const double _largeScreenBreakpoint = 960;
const String _appIconAsset =
'android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png';

class HomePage extends StatefulWidget {
final int initialSectionIndex;
Expand Down Expand Up @@ -159,15 +161,7 @@ class _HomePageState extends State<HomePage> {
extended: useExtendedRail,
leading: Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: useExtendedRail
? Text(
'OpenWearable',
style: Theme.of(context).textTheme.titleMedium,
)
: Icon(
Icons.watch,
color: Theme.of(context).colorScheme.primary,
),
child: _AppRailLogo(extended: useExtendedRail),
),
destinations: _destinations
.map(
Expand Down Expand Up @@ -251,3 +245,42 @@ class _HomeDestination {
required this.selectedIcon,
});
}

class _AppRailLogo extends StatelessWidget {
final bool extended;

const _AppRailLogo({
required this.extended,
});

@override
Widget build(BuildContext context) {
final icon = ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.asset(
_appIconAsset,
width: 32,
height: 32,
fit: BoxFit.cover,
filterQuality: FilterQuality.medium,
semanticLabel: 'OpenWearable app icon',
),
);

if (!extended) {
return icon;
}

return Row(
mainAxisSize: MainAxisSize.min,
children: [
icon,
const SizedBox(width: 12),
Text(
'OpenWearable',
style: Theme.of(context).textTheme.titleMedium,
),
],
);
}
}
Loading