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: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<MainScaffold> {
final buttons = [
FloatingActionButton(
child: const Icon(Icons.chat_bubble),
onPressed: () {},
onPressed: () => showDialog(
context: context,
builder: (context) => const MakePost(),
),
),
FloatingActionButton(
onPressed: () {},

View file

@ -12,29 +12,40 @@ class _PostState extends State<Post> {
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(