Skip to content

Commit

Permalink
updated note list ui
Browse files Browse the repository at this point in the history
  • Loading branch information
drriguz committed Mar 15, 2024
1 parent b9877a8 commit d6fed42
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 67 deletions.
6 changes: 6 additions & 0 deletions editing/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PODS:
- Flutter (1.0.0)
- flutter_keyboard_visibility (0.0.1):
- Flutter
- integration_test (0.0.1):
- Flutter
- path_provider_foundation (0.0.1):
Expand All @@ -16,6 +18,7 @@ PODS:

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- sqlcipher_flutter_libs (from `.symlinks/plugins/sqlcipher_flutter_libs/ios`)
Expand All @@ -27,6 +30,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_keyboard_visibility:
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
path_provider_foundation:
Expand All @@ -36,6 +41,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
integration_test: 13825b8a9334a850581300559b8839134b124670
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
SQLCipher: 838309284f29953a28ad2e81d87d55ea6b7c74fd
Expand Down
75 changes: 74 additions & 1 deletion editing/lib/ui/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class HomeScreen extends StatefulWidget {
State<HomeScreen> createState() => _KnowledgebaseScreenState();
}

class _KnowledgebaseScreenState extends State<HomeScreen> {
class _KnowledgebaseScreenState extends State<HomeScreen>
with SingleTickerProviderStateMixin {
int currentPageIndex = 0;
final List<Widget> pages = <Widget>[
NoteListPage(),
Expand All @@ -29,9 +30,77 @@ class _KnowledgebaseScreenState extends State<HomeScreen> {
});
}

late TabController _tabController;

@override
void initState() {
_tabController = TabController(length: 2, vsync: this);
super.initState();
}

@override
void dispose() {
super.dispose();
_tabController.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.menu_outlined),
tooltip: 'Menu',
onPressed: () {},
),
title: Text("Notes"),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.search_outlined),
tooltip: 'Search',
onPressed: () {},
),
IconButton(
icon: const Icon(Icons.add_outlined),
tooltip: 'Create',
onPressed: () {},
),
IconButton(
icon: const Icon(Icons.more_horiz),
tooltip: 'More options',
onPressed: () {
Navigator.push(context, MaterialPageRoute<void>(
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Next page'),
),
body: const Center(
child: Text(
'This is the next page',
style: TextStyle(fontSize: 24),
),
),
);
},
));
},
),
],
bottom: TabBar(
tabAlignment: TabAlignment.fill,
controller: _tabController,
isScrollable: false,
tabs: const [
Tab(
text: "Journal",
),
Tab(
text: "Notes",
),
],
),
),
bottomNavigationBar: NavigationBar(
onDestinationSelected: (int index) {
setState(() {
Expand Down Expand Up @@ -75,6 +144,10 @@ class _KnowledgebaseScreenState extends State<HomeScreen> {
],
),
body: pages.elementAt(currentPageIndex),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {},
),
);
}
}
2 changes: 1 addition & 1 deletion editing/lib/ui/screens/login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _LoginScreenState extends State<LoginScreen> {
}

return Padding(
padding: const EdgeInsets.fromLTRB(50, 10.0, 50, 10),
padding: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expand Down
35 changes: 16 additions & 19 deletions editing/lib/ui/screens/note_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,24 @@ class _NoteListPageState extends State<NoteListPage> {
Widget build(BuildContext context) {
final noteListStore = Provider.of<NoteListStore>(context);

return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Observer(
builder: (_) => Expanded(
child: ListView.builder(
itemCount: noteListStore.list.length,
itemBuilder: (_, index) {
final note = noteListStore.list[index];
return Note(
title: note.title,
createTime: note.createTime,
location: "",
content: note.content);
},
),
return Row(
children: [
Observer(
builder: (_) => Expanded(
child: ListView.builder(
itemCount: noteListStore.list.length,
itemBuilder: (_, index) {
final note = noteListStore.list[index];
return Note(
title: note.title,
createTime: note.createTime,
location: "",
content: note.content);
},
),
),
],
),
),
],
);
}
}
51 changes: 5 additions & 46 deletions editing/lib/ui/widgets/note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,12 @@ class Note extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Card(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 5),
child: Text(
content,
style: TextStyle(fontSize: 12, color: Colors.grey),
),
),
const Row(
children: [
Tag("旅行"),
Tag("杂记"),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
location,
style: TextStyle(fontSize: 10, color: Colors.grey),
),
Text(
'${createTime.year}-${createTime.month}-${createTime.day}',
style: TextStyle(fontSize: 10, color: Colors.grey),
),
],
),
],
),
return ListTile(
leading: const Icon(Icons.cloudy_snowing),
title: Text(
content,
),
subtitle: Text("今天天气十分好"),
);
}
}

0 comments on commit d6fed42

Please sign in to comment.