From e4a56146d59428dae90b8bbc091b11edcb958e7b Mon Sep 17 00:00:00 2001 From: zoe Date: Sun, 3 Jul 2022 16:56:41 +0200 Subject: [PATCH] post dialogue --- lib/dialogues/makepost.dart | 46 +++++++++++++++++++++++++++++++ lib/partials/main_scaffold.dart | 6 +++- lib/partials/post.dart | 49 +++++++++++++++++++++------------ 3 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 lib/dialogues/makepost.dart diff --git a/lib/dialogues/makepost.dart b/lib/dialogues/makepost.dart new file mode 100644 index 0000000..f811886 --- /dev/null +++ b/lib/dialogues/makepost.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; + +class MakePost extends StatelessWidget { + const MakePost({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SimpleDialog( + backgroundColor: Theme.of(context).colorScheme.background, + elevation: 0, + contentPadding: const EdgeInsets.all(24), + insetPadding: const EdgeInsets.all(24), + children: [ + TextFormField( + autofocus: true, + keyboardType: TextInputType.multiline, + minLines: 4, + maxLines: null, + ), + const MakePostActionBar(), + ], + ); + } +} + +class MakePostActionBar extends StatelessWidget { + const MakePostActionBar({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: Icon(Icons.cancel), + ), + IconButton( + onPressed: null, + icon: Icon(Icons.save), + ), + ], + ); + } +} diff --git a/lib/partials/main_scaffold.dart b/lib/partials/main_scaffold.dart index 51bfa11..1043e48 100644 --- a/lib/partials/main_scaffold.dart +++ b/lib/partials/main_scaffold.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:localization/localization.dart'; +import 'package:slothmu/dialogues/makepost.dart'; import 'package:slothmu/pages/chat/chat.dart'; import 'package:slothmu/pages/notifications/notifications.dart'; import 'package:slothmu/pages/timeline/timeline.dart'; @@ -26,7 +27,10 @@ class _MainScaffoldState extends State { final buttons = [ FloatingActionButton( child: const Icon(Icons.chat_bubble), - onPressed: () {}, + onPressed: () => showDialog( + context: context, + builder: (context) => const MakePost(), + ), ), FloatingActionButton( onPressed: () {}, diff --git a/lib/partials/post.dart b/lib/partials/post.dart index bc6e309..d1cb6d1 100644 --- a/lib/partials/post.dart +++ b/lib/partials/post.dart @@ -12,29 +12,40 @@ class _PostState extends State { Widget build(BuildContext context) { return Column( children: [ - Row( + const DisplayName(), + postBody(context), + postActionBar(context), + ], + ); + } +} + +class DisplayName extends StatelessWidget { + const DisplayName({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + const Icon( + Icons.face, + size: 64, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Icon( - Icons.face, - size: 64, + Text( + "first name display last name name", + style: Theme.of(context).textTheme.titleMedium, ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "first name display last name name", - style: Theme.of(context).textTheme.titleMedium, - ), - Text( - "@alice_exampleuser@example.com", - style: Theme.of(context).textTheme.bodySmall, - ), - ], + Text( + "@alice_exampleuser@example.com", + style: Theme.of(context).textTheme.bodySmall, ), ], ), - postBody(context), - postActionBar(context), ], ); } @@ -46,6 +57,8 @@ Widget postBody(context) { decoration: BoxDecoration( border: Border( left: BorderSide(color: Theme.of(context).colorScheme.onSurface), + bottom: BorderSide(color: Theme.of(context).colorScheme.onSurface), + top: BorderSide(color: Theme.of(context).colorScheme.onSurface), ), ), child: RichText(