Add initial project structure and configuration files
This commit is contained in:
30
lib/main.dart
Normal file
30
lib/main.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:capstone_project/pages/home.dart';
|
||||
import 'package:capstone_project/pages/settings.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ShadcnApp.router(
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorSchemes.darkRose
|
||||
),
|
||||
routerConfig: _routerConfig,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
GoRouter _routerConfig = GoRouter(
|
||||
routes: [
|
||||
HomePage.route,
|
||||
SettingsPage.route,
|
||||
]
|
||||
);
|
||||
35
lib/pages/home.dart
Normal file
35
lib/pages/home.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
import 'package:capstone_project/widgets/navbar.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
|
||||
static GoRoute route = GoRoute(
|
||||
path: "/",
|
||||
builder: (context, state) => HomePage()
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
return Scaffold(
|
||||
headers: [
|
||||
AppBar()
|
||||
],
|
||||
footers: [
|
||||
ProjNavBar(
|
||||
currentPage: "home",
|
||||
)
|
||||
],
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
83
lib/pages/settings.dart
Normal file
83
lib/pages/settings.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
import 'package:capstone_project/widgets/navbar.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
|
||||
class SettingsPage extends StatelessWidget {
|
||||
|
||||
static GoRoute route = GoRoute(
|
||||
path: "/settings",
|
||||
builder: (context, state) => SettingsPage()
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
return Scaffold(
|
||||
headers: [
|
||||
AppBar(
|
||||
title: Text("Settings"),
|
||||
)
|
||||
],
|
||||
footers: [
|
||||
ProjNavBar(
|
||||
currentPage: "settings",
|
||||
)
|
||||
],
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Text(
|
||||
"API Key"
|
||||
).extraBold,
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
TextField(
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Text(
|
||||
"Feeds"
|
||||
).extraBold,
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
TextField(
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
],
|
||||
).withMargin(
|
||||
all: 10
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
10
lib/providers/settings.dart
Normal file
10
lib/providers/settings.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SettingsProvider extends ChangeNotifier {
|
||||
|
||||
static SettingsProvider of(BuildContext context) {
|
||||
return context
|
||||
}
|
||||
|
||||
}ç
|
||||
53
lib/widgets/navbar.dart
Normal file
53
lib/widgets/navbar.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
|
||||
class ProjNavBar extends StatelessWidget {
|
||||
|
||||
|
||||
static final Map<String, int> _pageIndex = {
|
||||
"home": 0,
|
||||
"settings": 1
|
||||
};
|
||||
|
||||
late final int selectedIndex;
|
||||
|
||||
ProjNavBar({super.key, String currentPage = "home"}) {;
|
||||
selectedIndex = _pageIndex[currentPage] ?? 0;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
return NavigationBar(
|
||||
index: selectedIndex,
|
||||
onSelected: (index) {
|
||||
if (index == 0) {
|
||||
GoRouter.of(context).go("/");
|
||||
} else if (index == 1) {
|
||||
GoRouter.of(context).go("/settings");
|
||||
}
|
||||
},
|
||||
children: [
|
||||
NavigationItem(
|
||||
label: Text(
|
||||
"Home"
|
||||
),
|
||||
child: Icon(
|
||||
LucideIcons.house
|
||||
),
|
||||
),
|
||||
NavigationItem(
|
||||
label: Text(
|
||||
"Settings"
|
||||
),
|
||||
child: Icon(
|
||||
LucideIcons.settings
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user