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

View File

@ -12,6 +12,7 @@ import 'package:loris/global.dart' as global;
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:mime/mime.dart'; import 'package:mime/mime.dart';
import 'package:universal_io/io.dart' as io; import 'package:universal_io/io.dart' as io;
import 'package:loris/themes/themes.dart' as themes;
class MakePost extends StatefulWidget { class MakePost extends StatefulWidget {
const MakePost({Key? key, this.inReplyTo}) : super(key: key); const MakePost({Key? key, this.inReplyTo}) : super(key: key);
@ -393,7 +394,7 @@ class _MakePostState extends State<MakePost> {
return SimpleDialog( return SimpleDialog(
titlePadding: const EdgeInsets.all(0), titlePadding: const EdgeInsets.all(0),
alignment: Alignment.center, alignment: Alignment.center,
contentPadding: const EdgeInsets.all(24), contentPadding: themes.defaultMargins,
title: Column( title: Column(
children: [ children: [
if (status != null) SelectableText(status!), 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/partials/post_text_renderer.dart';
import 'package:loris/global.dart' as global; import 'package:loris/global.dart' as global;
import 'package:loris/partials/thread.dart'; import 'package:loris/partials/thread.dart';
import 'package:loris/themes/themes.dart' as themes;
class ProfileView extends StatefulWidget { class ProfileView extends StatefulWidget {
const ProfileView({ const ProfileView({
@ -210,7 +211,11 @@ class _ProfileViewState extends State<ProfileView> {
width: global.getWidth(context) + width: global.getWidth(context) +
MediaQuery.of(context).size.width * 0.2, MediaQuery.of(context).size.width * 0.2,
height: MediaQuery.of(context).size.height * 2 / 3, 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, controller: _scrollController,
itemCount: threads.length + 2, itemCount: threads.length + 2,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -218,7 +223,7 @@ class _ProfileViewState extends State<ProfileView> {
return profileViewDisplay; return profileViewDisplay;
} else if (index > 0 && index <= threads.length) { } else if (index > 0 && index <= threads.length) {
return Padding( return Padding(
padding: const EdgeInsets.all(8.0), padding: themes.defaultMargins,
child: Thread( child: Thread(
model: threads[index - 1], model: threads[index - 1],
constrained: false, constrained: false,
@ -352,7 +357,7 @@ class ProfileViewDisplay extends StatelessWidget {
errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(), errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(),
), ),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0), padding: themes.defaultMargins,
child: StatusIndicators( child: StatusIndicators(
model: accountModel, model: accountModel,
relationship: relationshipModel, relationship: relationshipModel,
@ -360,12 +365,12 @@ class ProfileViewDisplay extends StatelessWidget {
), ),
d, d,
Padding( Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0), padding: themes.defaultMargins,
child: PostTextRenderer(input: accountModel.note), child: PostTextRenderer(input: accountModel.note),
), ),
if (relationshipModel != null) if (relationshipModel != null)
Padding( Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0), padding: themes.defaultMargins,
child: AccountInteractionButtons( child: AccountInteractionButtons(
account: accountModel, account: accountModel,
relationship: relationshipModel!, 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/business_logic/timeline/timeline.dart';
import 'package:loris/global.dart' as global; import 'package:loris/global.dart' as global;
import 'package:loris/business_logic/search/search.dart' as logic; import 'package:loris/business_logic/search/search.dart' as logic;
import 'package:loris/themes/themes.dart' as themes;
import '../partials/post.dart'; import '../partials/post.dart';
@ -98,7 +99,7 @@ class _SearchDialogueState extends State<SearchDialogue> {
if (index < accountModels.length) { if (index < accountModels.length) {
final model = accountModels[index]; final model = accountModels[index];
return Padding( return Padding(
padding: const EdgeInsets.all(8.0), padding: themes.defaultMargins,
child: Column( child: Column(
children: [ children: [
SelectableText(model.identity), SelectableText(model.identity),

View File

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:loris/business_logic/settings.dart'; import 'package:loris/business_logic/settings.dart';
import 'themes/themes.dart' as themes;
const String name = "loris"; const String name = "loris";
const String version = "v0.4 'the posts update'"; const String version = "v0.4 'the posts update'";
@ -24,7 +25,8 @@ const List<String> bad = [
]; ];
double getWidth(context) { 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) { 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/pages/notifications/single_notif.dart';
import 'package:loris/partials/loadingbox.dart'; import 'package:loris/partials/loadingbox.dart';
import '../../business_logic/websocket.dart' as websocket; import '../../business_logic/websocket.dart' as websocket;
import 'package:loris/themes/themes.dart' as themes;
final notifStream = StreamController<int>.broadcast(); final notifStream = StreamController<int>.broadcast();
@ -133,6 +134,7 @@ class _NotificationsState extends State<Notifications> {
addSemanticIndexes: true, addSemanticIndexes: true,
itemBuilder: ((context, index) => notifs[index]), itemBuilder: ((context, index) => notifs[index]),
separatorBuilder: (context, index) => const Divider( separatorBuilder: (context, index) => const Divider(
height: themes.defaultSeperatorHeight,
color: Colors.transparent, color: Colors.transparent,
), ),
itemCount: notifs.length), 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/dialogues/profile_view.dart';
import 'package:loris/partials/post.dart'; import 'package:loris/partials/post.dart';
import '../../global.dart' as global; import '../../global.dart' as global;
import 'package:loris/themes/themes.dart' as themes;
class SingleNotif extends StatelessWidget { class SingleNotif extends StatelessWidget {
const SingleNotif({ const SingleNotif({
@ -17,19 +18,20 @@ class SingleNotif extends StatelessWidget {
child: Container( child: Container(
width: global.getWidth(context), width: global.getWidth(context),
constraints: global.getConstraints(context), constraints: global.getConstraints(context),
padding: const EdgeInsets.all(24), padding: themes.defaultInsideMargins,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
width: 2, width: 2,
), ),
borderRadius: BorderRadius.circular(8), borderRadius: const BorderRadius.all(themes.defaultRadius),
), ),
child: Material( child: Material(
child: Column( child: Column(
children: [ children: [
InkWell( InkWell(
borderRadius: const BorderRadius.all(themes.defaultRadius),
onTap: () => showDialog( onTap: () => showDialog(
context: context, context: context,
builder: (context) => ProfileView(model: model.account), 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 '../../business_logic/timeline/timeline.dart' as tl;
import '../../global.dart' as global; import '../../global.dart' as global;
import 'package:loris/partials/loadingbox.dart'; import 'package:loris/partials/loadingbox.dart';
import 'package:loris/themes/themes.dart' as themes;
class Timeline extends StatefulWidget { class Timeline extends StatefulWidget {
const Timeline({Key? key}) : super(key: key); const Timeline({Key? key}) : super(key: key);
@ -212,6 +213,7 @@ class TimelineState extends State<Timeline> {
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return const Divider( return const Divider(
color: Colors.transparent, color: Colors.transparent,
height: themes.defaultSeperatorHeight,
); );
}, },
itemCount: children.length, 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 'package:url_launcher/url_launcher_string.dart';
import '../business_logic/timeline/timeline.dart' as tl; import '../business_logic/timeline/timeline.dart' as tl;
import '../business_logic/interactions/interactions.dart' as interactions; import '../business_logic/interactions/interactions.dart' as interactions;
import 'package:loris/themes/themes.dart' as themes;
class Post extends StatefulWidget { class Post extends StatefulWidget {
const Post({ const Post({
@ -36,6 +37,7 @@ class _PostState extends State<Post> {
List<Widget> c = []; List<Widget> c = [];
c.addAll([ c.addAll([
DisplayName(account: widget.model.account), DisplayName(account: widget.model.account),
const SizedBox(height: 2),
SizedBox( SizedBox(
width: double.maxFinite, width: double.maxFinite,
child: PostBody( child: PostBody(
@ -87,6 +89,7 @@ class DisplayName extends StatelessWidget {
usernameStyle = Theme.of(context).textTheme.displaySmall; usernameStyle = Theme.of(context).textTheme.displaySmall;
} }
return InkWell( return InkWell(
borderRadius: const BorderRadius.all(themes.defaultRadius),
onTap: !openInBrowser onTap: !openInBrowser
? () { ? () {
showDialog( showDialog(
@ -169,7 +172,7 @@ class ProfilePic extends StatelessWidget {
const double width = 64; const double width = 64;
if (url.isNotEmpty) { if (url.isNotEmpty) {
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(8), borderRadius: const BorderRadius.all(themes.defaultRadius),
child: Image.network( child: Image.network(
fit: BoxFit.cover, fit: BoxFit.cover,
url, url,
@ -227,13 +230,13 @@ class _PostBodyState extends State<PostBody> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
borderRadius: const BorderRadius.all(themes.defaultRadius),
onTap: () => showDialog( onTap: () => showDialog(
context: context, context: context,
builder: (context) => FullPostView(originPostModel: widget.model), builder: (context) => FullPostView(originPostModel: widget.model),
), ),
child: Container( child: SizedBox(
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.fromLTRB(0, 6, 0, 6),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View File

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

View File

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