refactor: Theme and iOS stuff

This commit is contained in:
Christian Pauly 2021-01-24 16:38:25 +01:00
commit 66c163ce35
12 changed files with 70 additions and 468 deletions

View file

@ -1,3 +1,5 @@
import 'dart:ui';
abstract class AppConfig {
static String _applicationName = 'FluffyChat';
static String get applicationName => _applicationName;
@ -8,6 +10,7 @@ abstract class AppConfig {
static String jitsiInstance = 'https://meet.jit.si/';
static const bool allowOtherHomeservers = true;
static const bool enableRegistration = true;
static const Color primaryColor = Color(0xFF5625BA);
static String _privacyUrl = 'https://fluffychat.im/en/privacy.html';
static String get privacyUrl => _privacyUrl;
static const String appId = 'im.fluffychat.FluffyChat';

View file

@ -66,7 +66,6 @@ class ContentBanner extends StatelessWidget {
alignment: Alignment.bottomRight,
child: FloatingActionButton(
mini: true,
backgroundColor: Theme.of(context).primaryColor,
child: Icon(Icons.camera_alt_outlined),
onPressed: onEdit,
),

View file

@ -19,7 +19,6 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:provider/provider.dart';
import 'package:universal_html/prefer_universal/html.dart' as html;
import 'package:url_launcher/url_launcher.dart';
import 'package:http/http.dart' as http;
/*import 'package:fluffychat/views/chat.dart';
import 'package:fluffychat/app_config.dart';
@ -33,7 +32,6 @@ import 'dialogs/key_verification_dialog.dart';
import '../utils/platform_infos.dart';
import '../app_config.dart';
import '../config/setting_keys.dart';
import 'avatar.dart';
class Matrix extends StatefulWidget {
static const String callNamespace = 'chat.fluffy.jitsi_call';
@ -171,61 +169,6 @@ class MatrixState extends State<Matrix> {
}
}
void onJitsiCall(EventUpdate eventUpdate) {
final event = Event.fromJson(
eventUpdate.content, client.getRoomById(eventUpdate.roomID));
if (DateTime.now().millisecondsSinceEpoch -
event.originServerTs.millisecondsSinceEpoch >
1000 * 60 * 5) {
return;
}
final senderName = event.sender.calcDisplayname();
final senderAvatar = event.sender.avatarUrl;
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(L10n.of(context).videoCall),
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
contentPadding: EdgeInsets.all(0),
leading: Avatar(senderAvatar, senderName),
title: Text(
senderName,
style: TextStyle(fontSize: 18),
),
subtitle:
event.room.isDirectChat ? null : Text(event.room.displayname),
),
Divider(),
Row(
children: <Widget>[
Spacer(),
FloatingActionButton(
backgroundColor: Colors.red,
child: Icon(Icons.phone_missed_outlined),
onPressed: () => Navigator.of(context).pop(),
),
Spacer(),
FloatingActionButton(
backgroundColor: Colors.green,
child: Icon(Icons.phone_outlined),
onPressed: () {
Navigator.of(context).pop();
launch(event.body);
},
),
Spacer(),
],
),
],
),
),
);
return;
}
bool webHasFocus = true;
void _showLocalNotification(EventUpdate eventUpdate) async {

View file

@ -2,6 +2,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import '../app_config.dart';
abstract class FluffyThemes {
static const double columnWidth = 360.0;
@ -29,7 +31,7 @@ abstract class FluffyThemes {
primaryColorDark: Colors.white,
primaryColorLight: Color(0xff121212),
brightness: Brightness.light,
primaryColor: Color(0xFF5625BA),
primaryColor: AppConfig.primaryColor,
backgroundColor: Colors.white,
secondaryHeaderColor: Color(0xFFECECF2),
scaffoldBackgroundColor: Colors.white,
@ -47,6 +49,10 @@ abstract class FluffyThemes {
borderRadius: BorderRadius.circular(8.0),
),
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: AppConfig.primaryColor,
foregroundColor: Colors.white,
),
appBarTheme: AppBarTheme(
brightness: Brightness.light,
color: Colors.white,
@ -60,7 +66,7 @@ abstract class FluffyThemes {
),
);
static ThemeData dark = ThemeData.dark().copyWith(
static ThemeData dark = light.copyWith(
primaryColorDark: Color(0xff121212),
primaryColorLight: Colors.white,
primaryColor: Color(0xFF8966CF),
@ -70,19 +76,6 @@ abstract class FluffyThemes {
accentColor: Color(0xFFF5B4D2),
secondaryHeaderColor: Color(0xff1D1D1D),
textTheme: Typography.material2018().white.merge(fallback_text_theme),
snackBarTheme: SnackBarThemeData(
behavior: kIsWeb ? SnackBarBehavior.floating : SnackBarBehavior.fixed,
),
dialogTheme: DialogTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
popupMenuTheme: PopupMenuThemeData(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
appBarTheme: AppBarTheme(
brightness: Brightness.dark,
color: Color(0xff1D1D1D),

View file

@ -256,7 +256,6 @@ class _ChatListState extends State<ChatList> {
? null
: FloatingActionButton(
child: Icon(Icons.add_outlined),
backgroundColor: Theme.of(context).primaryColor,
onPressed: () => AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/newprivatechat'),
),

View file

@ -73,8 +73,6 @@ class _NewGroupState extends State<NewGroup> {
],
),
floatingActionButton: FloatingActionButton(
foregroundColor: Colors.white,
backgroundColor: Theme.of(context).primaryColor,
onPressed: () => submitAction(context),
child: Icon(Icons.arrow_forward_outlined),
),

View file

@ -212,8 +212,6 @@ class _NewPrivateChatState extends State<NewPrivateChat> {
floatingActionButton: FloatingActionButton(
onPressed: () => submitAction(context),
child: Icon(Icons.arrow_forward_outlined),
foregroundColor: Colors.white,
backgroundColor: Theme.of(context).primaryColor,
),
);
}

View file

@ -181,7 +181,6 @@ class _EmotesSettingsState extends State<EmotesSettings> {
showSave = false;
});
},
backgroundColor: Theme.of(context).primaryColor,
)
: null,
body: StreamBuilder(