post dialogue

This commit is contained in:
zoe 2022-07-03 16:56:41 +02:00
parent ee081de0ab
commit e4a56146d5
3 changed files with 82 additions and 19 deletions

View file

@ -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),
),
],
);
}
}

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:localization/localization.dart'; import 'package:localization/localization.dart';
import 'package:slothmu/dialogues/makepost.dart';
import 'package:slothmu/pages/chat/chat.dart'; import 'package:slothmu/pages/chat/chat.dart';
import 'package:slothmu/pages/notifications/notifications.dart'; import 'package:slothmu/pages/notifications/notifications.dart';
import 'package:slothmu/pages/timeline/timeline.dart'; import 'package:slothmu/pages/timeline/timeline.dart';
@ -26,7 +27,10 @@ class _MainScaffoldState extends State<MainScaffold> {
final buttons = [ final buttons = [
FloatingActionButton( FloatingActionButton(
child: const Icon(Icons.chat_bubble), child: const Icon(Icons.chat_bubble),
onPressed: () {}, onPressed: () => showDialog(
context: context,
builder: (context) => const MakePost(),
),
), ),
FloatingActionButton( FloatingActionButton(
onPressed: () {}, onPressed: () {},

View file

@ -12,29 +12,40 @@ class _PostState extends State<Post> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ 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: [ children: [
const Icon( Text(
Icons.face, "first name display last name name",
size: 64, style: Theme.of(context).textTheme.titleMedium,
), ),
Column( Text(
crossAxisAlignment: CrossAxisAlignment.start, "@alice_exampleuser@example.com",
children: [ style: Theme.of(context).textTheme.bodySmall,
Text(
"first name display last name name",
style: Theme.of(context).textTheme.titleMedium,
),
Text(
"@alice_exampleuser@example.com",
style: Theme.of(context).textTheme.bodySmall,
),
],
), ),
], ],
), ),
postBody(context),
postActionBar(context),
], ],
); );
} }
@ -46,6 +57,8 @@ Widget postBody(context) {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
left: BorderSide(color: Theme.of(context).colorScheme.onSurface), 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( child: RichText(