unify spacing

This commit is contained in:
zoe 2022-09-26 16:30:02 +02:00
parent ad7aaa5c24
commit b281ffc061
11 changed files with 56 additions and 26 deletions

View File

@ -4,6 +4,7 @@ import 'package:loris/business_logic/network_tools/get_post_from_url.dart';
import 'package:loris/business_logic/posts/posts.dart';
import 'package:loris/business_logic/timeline/timeline.dart';
import 'package:loris/global.dart' as global;
import 'package:loris/themes/themes.dart' as themes;
import '../partials/post.dart';
@ -126,7 +127,7 @@ class _FullPostViewState extends State<FullPostView> {
],
)
: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
padding: themes.defaultInsideMargins,
child: Wrap(
alignment: WrapAlignment.spaceAround,
crossAxisAlignment: WrapCrossAlignment.center,
@ -188,13 +189,16 @@ class _FullPostViewState extends State<FullPostView> {
maxWidth: global.getConstraints(context).maxWidth),
width: global.getWidth(context),
child: SingleChildScrollView(
child: SingleFullPostDisplay(
ancestors: ancestors,
descendants: descendants,
hidden: widget.hidden,
level: 0,
model: identities[activeIdentity]!.reblog ??
identities[activeIdentity]!,
child: Padding(
padding: themes.defaultMargins,
child: SingleFullPostDisplay(
ancestors: ancestors,
descendants: descendants,
hidden: widget.hidden,
level: 0,
model: identities[activeIdentity]!.reblog ??
identities[activeIdentity]!,
),
),
),
)
@ -251,7 +255,7 @@ class SingleFullPostDisplay extends StatelessWidget {
c.addAll(descendantsWidgets);
return Container(
padding:
EdgeInsets.fromLTRB(level == 0 ? 4 : 4, 0, level == 0 ? 4 : 0, 0),
EdgeInsets.fromLTRB(level == 0 ? 0 : 4, 0, level == 0 ? 0 : 4, 0),
decoration: BoxDecoration(
border: level == 0
? const Border()

View File

@ -12,6 +12,7 @@ import 'package:loris/global.dart' as global;
import 'package:file_picker/file_picker.dart';
import 'package:mime/mime.dart';
import 'package:universal_io/io.dart' as io;
import 'package:loris/themes/themes.dart' as themes;
class MakePost extends StatefulWidget {
const MakePost({Key? key, this.inReplyTo}) : super(key: key);
@ -393,7 +394,7 @@ class _MakePostState extends State<MakePost> {
return SimpleDialog(
titlePadding: const EdgeInsets.all(0),
alignment: Alignment.center,
contentPadding: const EdgeInsets.all(24),
contentPadding: themes.defaultMargins,
title: Column(
children: [
if (status != null) SelectableText(status!),

View File

@ -10,6 +10,7 @@ import 'package:loris/partials/post.dart';
import 'package:loris/partials/post_text_renderer.dart';
import 'package:loris/global.dart' as global;
import 'package:loris/partials/thread.dart';
import 'package:loris/themes/themes.dart' as themes;
class ProfileView extends StatefulWidget {
const ProfileView({
@ -210,7 +211,11 @@ class _ProfileViewState extends State<ProfileView> {
width: global.getWidth(context) +
MediaQuery.of(context).size.width * 0.2,
height: MediaQuery.of(context).size.height * 2 / 3,
child: ListView.builder(
child: ListView.separated(
separatorBuilder: (context, index) => const Divider(
color: Colors.transparent,
height: themes.defaultSeperatorHeight,
),
controller: _scrollController,
itemCount: threads.length + 2,
itemBuilder: (context, index) {
@ -218,7 +223,7 @@ class _ProfileViewState extends State<ProfileView> {
return profileViewDisplay;
} else if (index > 0 && index <= threads.length) {
return Padding(
padding: const EdgeInsets.all(8.0),
padding: themes.defaultMargins,
child: Thread(
model: threads[index - 1],
constrained: false,
@ -352,7 +357,7 @@ class ProfileViewDisplay extends StatelessWidget {
errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(),
),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
padding: themes.defaultMargins,
child: StatusIndicators(
model: accountModel,
relationship: relationshipModel,
@ -360,12 +365,12 @@ class ProfileViewDisplay extends StatelessWidget {
),
d,
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
padding: themes.defaultMargins,
child: PostTextRenderer(input: accountModel.note),
),
if (relationshipModel != null)
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
padding: themes.defaultMargins,
child: AccountInteractionButtons(
account: accountModel,
relationship: relationshipModel!,

View File

@ -4,6 +4,7 @@ import 'package:loris/business_logic/account/account.dart';
import 'package:loris/business_logic/timeline/timeline.dart';
import 'package:loris/global.dart' as global;
import 'package:loris/business_logic/search/search.dart' as logic;
import 'package:loris/themes/themes.dart' as themes;
import '../partials/post.dart';
@ -98,7 +99,7 @@ class _SearchDialogueState extends State<SearchDialogue> {
if (index < accountModels.length) {
final model = accountModels[index];
return Padding(
padding: const EdgeInsets.all(8.0),
padding: themes.defaultMargins,
child: Column(
children: [
SelectableText(model.identity),

View File

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:loris/business_logic/settings.dart';
import 'themes/themes.dart' as themes;
const String name = "loris";
const String version = "v0.4 'the posts update'";
@ -24,7 +25,8 @@ const List<String> bad = [
];
double getWidth(context) {
return (MediaQuery.of(context).size.width * settings!.postWidth) - 24;
return (MediaQuery.of(context).size.width * settings!.postWidth) -
(themes.defaultSeperatorHeight * 2);
}
BoxConstraints getConstraints(context) {

View File

@ -7,6 +7,7 @@ import 'package:loris/business_logic/notifications/notifs.dart';
import 'package:loris/pages/notifications/single_notif.dart';
import 'package:loris/partials/loadingbox.dart';
import '../../business_logic/websocket.dart' as websocket;
import 'package:loris/themes/themes.dart' as themes;
final notifStream = StreamController<int>.broadcast();
@ -133,6 +134,7 @@ class _NotificationsState extends State<Notifications> {
addSemanticIndexes: true,
itemBuilder: ((context, index) => notifs[index]),
separatorBuilder: (context, index) => const Divider(
height: themes.defaultSeperatorHeight,
color: Colors.transparent,
),
itemCount: notifs.length),

View File

@ -3,6 +3,7 @@ import 'package:loris/business_logic/notifications/notifs.dart';
import 'package:loris/dialogues/profile_view.dart';
import 'package:loris/partials/post.dart';
import '../../global.dart' as global;
import 'package:loris/themes/themes.dart' as themes;
class SingleNotif extends StatelessWidget {
const SingleNotif({
@ -17,19 +18,20 @@ class SingleNotif extends StatelessWidget {
child: Container(
width: global.getWidth(context),
constraints: global.getConstraints(context),
padding: const EdgeInsets.all(24),
padding: themes.defaultInsideMargins,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
border: Border.all(
color: Theme.of(context).colorScheme.secondary,
width: 2,
),
borderRadius: BorderRadius.circular(8),
borderRadius: const BorderRadius.all(themes.defaultRadius),
),
child: Material(
child: Column(
children: [
InkWell(
borderRadius: const BorderRadius.all(themes.defaultRadius),
onTap: () => showDialog(
context: context,
builder: (context) => ProfileView(model: model.account),

View File

@ -5,6 +5,7 @@ import 'package:loris/partials/thread.dart';
import '../../business_logic/timeline/timeline.dart' as tl;
import '../../global.dart' as global;
import 'package:loris/partials/loadingbox.dart';
import 'package:loris/themes/themes.dart' as themes;
class Timeline extends StatefulWidget {
const Timeline({Key? key}) : super(key: key);
@ -212,6 +213,7 @@ class TimelineState extends State<Timeline> {
separatorBuilder: (context, index) {
return const Divider(
color: Colors.transparent,
height: themes.defaultSeperatorHeight,
);
},
itemCount: children.length,

View File

@ -12,6 +12,7 @@ import 'package:loris/partials/post_text_renderer.dart';
import 'package:url_launcher/url_launcher_string.dart';
import '../business_logic/timeline/timeline.dart' as tl;
import '../business_logic/interactions/interactions.dart' as interactions;
import 'package:loris/themes/themes.dart' as themes;
class Post extends StatefulWidget {
const Post({
@ -36,6 +37,7 @@ class _PostState extends State<Post> {
List<Widget> c = [];
c.addAll([
DisplayName(account: widget.model.account),
const SizedBox(height: 2),
SizedBox(
width: double.maxFinite,
child: PostBody(
@ -87,6 +89,7 @@ class DisplayName extends StatelessWidget {
usernameStyle = Theme.of(context).textTheme.displaySmall;
}
return InkWell(
borderRadius: const BorderRadius.all(themes.defaultRadius),
onTap: !openInBrowser
? () {
showDialog(
@ -169,7 +172,7 @@ class ProfilePic extends StatelessWidget {
const double width = 64;
if (url.isNotEmpty) {
return ClipRRect(
borderRadius: BorderRadius.circular(8),
borderRadius: const BorderRadius.all(themes.defaultRadius),
child: Image.network(
fit: BoxFit.cover,
url,
@ -227,13 +230,13 @@ class _PostBodyState extends State<PostBody> {
@override
Widget build(BuildContext context) {
return InkWell(
borderRadius: const BorderRadius.all(themes.defaultRadius),
onTap: () => showDialog(
context: context,
builder: (context) => FullPostView(originPostModel: widget.model),
),
child: Container(
child: SizedBox(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(0, 6, 0, 6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

View File

@ -3,6 +3,7 @@ import 'package:localization/localization.dart';
import 'package:loris/partials/post.dart';
import '../business_logic/timeline/timeline.dart' as logic;
import '../global.dart' as global;
import 'package:loris/themes/themes.dart' as themes;
class Thread extends StatefulWidget {
const Thread({
@ -111,7 +112,7 @@ class _ThreadState extends State<Thread> {
child: Material(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Padding(
padding: const EdgeInsets.all(24),
padding: themes.defaultInsideMargins,
child: Column(
children: c,
),

View File

@ -16,6 +16,9 @@ bool checkActive(Set<MaterialState> states) {
}
const defaultRadius = Radius.circular(8);
const defaultSeperatorHeight = 4.0;
const defaultInsideMargins = EdgeInsets.all(18);
const defaultMargins = EdgeInsets.all(18);
// color schemes to pick from can be added here
// there is a class to create these
@ -210,14 +213,18 @@ ThemeData getTheme(CustomColors colors) {
dialogTheme: DialogTheme(
elevation: 0,
backgroundColor: colors.colorScheme.surface,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(defaultRadius))),
shape: RoundedRectangleBorder(
side: BorderSide(
width: 2,
color: colors.colorScheme.secondary,
style: BorderStyle.solid),
borderRadius: const BorderRadius.all(defaultRadius))),
selectedRowColor: colors.colorScheme.background,
textSelectionTheme:
TextSelectionThemeData(selectionColor: colors.hintColor),
primaryIconTheme: const IconThemeData(size: 24),
hoverColor: colors.hoverColor,
shadowColor: colors.colorScheme.surface,
shadowColor: Colors.transparent,
focusColor: colors.hoverColor,
indicatorColor: colors.hintColor,
disabledColor: colors.hintColor,