2022-10-23 13:50:44 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:notes/CollapseDrawer.dart';
|
|
|
|
import 'package:notes/all_notes_page.dart';
|
2022-10-24 00:02:35 +00:00
|
|
|
import 'package:notes/canvas/drawing_canvas.dart';
|
2022-10-23 13:50:44 +00:00
|
|
|
|
|
|
|
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 MaterialApp(
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
theme: ThemeData(
|
|
|
|
// is not restarted.
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
),
|
|
|
|
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
|
|
|
|
final String title;
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
|
|
View activePage = View.all;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2022-10-24 00:02:35 +00:00
|
|
|
floatingActionButton: _fab(),
|
2022-10-23 13:50:44 +00:00
|
|
|
body: Row(
|
|
|
|
children: [
|
|
|
|
CollapseDrawer(
|
2022-10-23 15:57:59 +00:00
|
|
|
onPageChange: (View newPage) =>
|
|
|
|
setState(() => activePage = newPage),
|
|
|
|
activePage: activePage,
|
|
|
|
),
|
2022-10-23 13:50:44 +00:00
|
|
|
Expanded(
|
|
|
|
child: Container(
|
2022-10-23 15:57:59 +00:00
|
|
|
color: const Color(0xff0d0d0d),
|
|
|
|
child: _buildPage(),
|
|
|
|
))
|
2022-10-23 13:50:44 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-10-24 00:02:35 +00:00
|
|
|
Widget _fab() {
|
|
|
|
switch (activePage) {
|
|
|
|
case View.all:
|
|
|
|
case View.folders:
|
|
|
|
return FloatingActionButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => const DrawingCanvas(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
backgroundColor: const Color(0xff3f3f3f),
|
|
|
|
child: const Icon(Icons.edit_calendar_outlined, color: Colors.orange),
|
|
|
|
);
|
|
|
|
default:
|
|
|
|
return Container();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-23 13:50:44 +00:00
|
|
|
Widget _buildPage() {
|
|
|
|
switch (activePage) {
|
|
|
|
case View.all:
|
|
|
|
return const AllNotesPage();
|
|
|
|
case View.shared:
|
2022-10-23 15:57:59 +00:00
|
|
|
return const Text(
|
2022-10-24 00:02:35 +00:00
|
|
|
'shared notebooks WIP',
|
2022-10-23 15:57:59 +00:00
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
);
|
2022-10-23 13:50:44 +00:00
|
|
|
case View.recycle:
|
2022-10-23 15:57:59 +00:00
|
|
|
return const Text(
|
2022-10-24 00:02:35 +00:00
|
|
|
'recycle bin WIP',
|
2022-10-23 15:57:59 +00:00
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
);
|
2022-10-23 13:50:44 +00:00
|
|
|
case View.folders:
|
2022-10-23 15:57:59 +00:00
|
|
|
return const Text(
|
2022-10-24 00:02:35 +00:00
|
|
|
'Folders WIP',
|
2022-10-23 15:57:59 +00:00
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
);
|
2022-10-23 13:50:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|