🎉 Initial Commit

This commit is contained in:
2024-11-09 00:09:46 +08:00
commit 2021f7beb9
150 changed files with 8217 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import 'package:flutter/material.dart';
class AppBackground extends StatelessWidget {
final Widget child;
const AppBackground({super.key, required this.child});
@override
Widget build(BuildContext context) {
return ScaffoldMessenger(child: child);
}
}

View File

@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:surface/widgets/navigation/app_destinations.dart';
class AppBottomNavigationBar extends StatefulWidget {
const AppBottomNavigationBar({super.key});
@override
State<AppBottomNavigationBar> createState() => _AppBottomNavigationBarState();
}
class _AppBottomNavigationBarState extends State<AppBottomNavigationBar> {
int _currentIndex = 0;
@override
Widget build(BuildContext context) {
return BottomNavigationBar(
currentIndex: _currentIndex,
type: BottomNavigationBarType.fixed,
showUnselectedLabels: false,
items: appDestinations.map((ele) {
return BottomNavigationBarItem(
icon: ele.icon,
label: ele.label,
);
}).toList(),
onTap: (idx) {
setState(() => _currentIndex = idx);
GoRouter.of(context).goNamed(appDestinations[idx].screen);
},
);
}
}

View File

@ -0,0 +1,33 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:material_symbols_icons/symbols.dart';
class AppNavDestination {
final String label;
final String screen;
final Widget icon;
AppNavDestination({
required this.label,
required this.screen,
required this.icon,
});
}
List<AppNavDestination> appDestinations = [
AppNavDestination(
icon: Icon(Symbols.home),
screen: 'home',
label: tr('screenHome'),
),
AppNavDestination(
icon: Icon(Symbols.explore),
screen: 'explore',
label: tr('screenExplore'),
),
AppNavDestination(
icon: Icon(Symbols.account_circle),
screen: 'account',
label: tr('screenAccount'),
),
];

View File

@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
import 'package:responsive_framework/responsive_framework.dart';
import 'package:surface/widgets/navigation/app_background.dart';
import 'package:surface/widgets/navigation/app_bottom_navigation.dart';
class AppScaffold extends StatelessWidget {
final PreferredSizeWidget? appBar;
final Widget? body;
final bool? showBottomNavigation;
const AppScaffold(
{super.key, this.appBar, this.body, this.showBottomNavigation});
@override
Widget build(BuildContext context) {
final isShowBottomNavigation = (showBottomNavigation ?? false)
? ResponsiveBreakpoints.of(context).smallerOrEqualTo(MOBILE)
: false;
return AppBackground(
child: Scaffold(
appBar: appBar,
body: body,
bottomNavigationBar:
isShowBottomNavigation ? AppBottomNavigationBar() : null,
),
);
}
}