refactor: border radius

This commit is contained in:
Christian Pauly 2021-02-07 09:12:34 +01:00
parent ea1bb89025
commit ddd10d189d
9 changed files with 30 additions and 17 deletions

View File

@ -41,6 +41,8 @@ abstract class AppConfig {
static const String emojiFontName = 'Noto Emoji'; static const String emojiFontName = 'Noto Emoji';
static const String emojiFontUrl = static const String emojiFontUrl =
'https://github.com/googlefonts/noto-emoji/'; 'https://github.com/googlefonts/noto-emoji/';
static const double borderRadius = 12.0;
static const double messageBubbleBorderRadius = 16.0;
static void loadFromJson(Map<String, dynamic> json) { static void loadFromJson(Map<String, dynamic> json) {
if (json['application_name'] is String) { if (json['application_name'] is String) {

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../app_config.dart';
class DefaultAppBarSearchField extends StatefulWidget { class DefaultAppBarSearchField extends StatefulWidget {
final TextEditingController searchController; final TextEditingController searchController;
final void Function(String) onChanged; final void Function(String) onChanged;
@ -81,7 +83,7 @@ class DefaultAppBarSearchFieldState extends State<DefaultAppBarSearchField> {
decoration: InputDecoration( decoration: InputDecoration(
prefixText: widget.prefixText, prefixText: widget.prefixText,
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
borderSide: borderSide:
BorderSide(color: Theme.of(context).secondaryHeaderColor), BorderSide(color: Theme.of(context).secondaryHeaderColor),
), ),

View File

@ -76,8 +76,6 @@ class Message extends StatelessWidget {
: Theme.of(context).primaryColor; : Theme.of(context).primaryColor;
} }
final radius = 16.0;
var rowChildren = <Widget>[ var rowChildren = <Widget>[
Expanded( Expanded(
child: Container( child: Container(
@ -87,7 +85,8 @@ class Message extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color, color: color,
borderRadius: BorderRadius.circular(radius), borderRadius:
BorderRadius.circular(AppConfig.messageBubbleBorderRadius),
), ),
constraints: constraints:
BoxConstraints(maxWidth: FluffyThemes.columnWidth * 1.5), BoxConstraints(maxWidth: FluffyThemes.columnWidth * 1.5),

View File

@ -42,12 +42,12 @@ abstract class FluffyThemes {
), ),
dialogTheme: DialogTheme( dialogTheme: DialogTheme(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
), ),
popupMenuTheme: PopupMenuThemeData( popupMenuTheme: PopupMenuThemeData(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
), ),
floatingActionButtonTheme: FloatingActionButtonThemeData( floatingActionButtonTheme: FloatingActionButtonThemeData(
@ -55,9 +55,10 @@ abstract class FluffyThemes {
foregroundColor: Colors.white, foregroundColor: Colors.white,
), ),
inputDecorationTheme: InputDecorationTheme( inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)), border: OutlineInputBorder(
borderRadius: BorderRadius.circular(AppConfig.borderRadius)),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
borderSide: BorderSide( borderSide: BorderSide(
color: AppConfig.primaryColor.withAlpha(16), color: AppConfig.primaryColor.withAlpha(16),
), ),
@ -90,12 +91,12 @@ abstract class FluffyThemes {
textTheme: Typography.material2018().white.merge(fallback_text_theme), textTheme: Typography.material2018().white.merge(fallback_text_theme),
dialogTheme: DialogTheme( dialogTheme: DialogTheme(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
), ),
popupMenuTheme: PopupMenuThemeData( popupMenuTheme: PopupMenuThemeData(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
), ),
floatingActionButtonTheme: FloatingActionButtonThemeData( floatingActionButtonTheme: FloatingActionButtonThemeData(
@ -103,11 +104,12 @@ abstract class FluffyThemes {
foregroundColor: Colors.white, foregroundColor: Colors.white,
), ),
inputDecorationTheme: InputDecorationTheme( inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)), border: OutlineInputBorder(
borderRadius: BorderRadius.circular(AppConfig.borderRadius)),
filled: true, filled: true,
fillColor: AppConfig.primaryColorLight.withAlpha(32), fillColor: AppConfig.primaryColorLight.withAlpha(32),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
borderSide: BorderSide( borderSide: BorderSide(
color: AppConfig.primaryColor.withAlpha(16), color: AppConfig.primaryColor.withAlpha(16),
), ),

View File

@ -7,6 +7,7 @@ import 'package:fluffychat/components/list_items/contact_list_tile.dart';
import 'package:fluffychat/components/matrix.dart'; import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/fluffy_share.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../app_config.dart';
import '../../utils/client_presence_extension.dart'; import '../../utils/client_presence_extension.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -96,7 +97,8 @@ class _ContactListState extends State<ContactList> {
elevation: 7, elevation: 7,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

View File

@ -172,7 +172,7 @@ class _HomeserverPickerState extends State<HomeserverPicker> {
elevation: 7, elevation: 7,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
child: _isLoading child: _isLoading
? LinearProgressIndicator() ? LinearProgressIndicator()

View File

@ -9,6 +9,8 @@ import 'package:flushbar/flushbar_helper.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../app_config.dart';
class Login extends StatefulWidget { class Login extends StatefulWidget {
@override @override
_LoginState createState() => _LoginState(); _LoginState createState() => _LoginState();
@ -222,7 +224,7 @@ class _LoginState extends State<Login> {
elevation: 7, elevation: 7,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
child: loading child: loading
? LinearProgressIndicator() ? LinearProgressIndicator()

View File

@ -9,6 +9,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../app_config.dart';
class SignUp extends StatefulWidget { class SignUp extends StatefulWidget {
@override @override
_SignUpState createState() => _SignUpState(); _SignUpState createState() => _SignUpState();
@ -143,7 +145,7 @@ class _SignUpState extends State<SignUp> {
elevation: 7, elevation: 7,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
child: loading child: loading
? LinearProgressIndicator() ? LinearProgressIndicator()

View File

@ -9,6 +9,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../app_config.dart';
class SignUpPassword extends StatefulWidget { class SignUpPassword extends StatefulWidget {
final MatrixFile avatar; final MatrixFile avatar;
final String username; final String username;
@ -176,7 +178,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
elevation: 7, elevation: 7,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
), ),
child: loading child: loading
? LinearProgressIndicator() ? LinearProgressIndicator()