contacts that are blocked get blocked colors; rework opaque theming a little, start using for font size #200
|
@ -22,7 +22,7 @@ import 'dart:io' show Platform, exit;
|
|||
import 'opaque.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
var globalSettings = Settings(Locale("en", ''), Opaque.dark);
|
||||
var globalSettings = Settings(Locale("en", ''), OpaqueDark());
|
||||
var globalErrorHandler = ErrorHandler();
|
||||
var globalTorStatus = TorStatus();
|
||||
var globalAppState = AppState();
|
||||
|
|
|
@ -15,7 +15,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|||
import 'package:glob/glob.dart';
|
||||
import 'package:glob/list_local_fs.dart';
|
||||
|
||||
var globalSettings = Settings(Locale("en", ''), Opaque.dark);
|
||||
var globalSettings = Settings(Locale("en", ''), OpaqueDark());
|
||||
var globalErrorHandler = ErrorHandler();
|
||||
|
||||
void main() {
|
||||
|
|
207
lib/opaque.dart
207
lib/opaque.dart
|
@ -10,6 +10,11 @@ import 'package:cwtch/settings.dart';
|
|||
|
||||
abstract class OpaqueThemeType {
|
||||
static final Color red = Color(0xFFFF0000);
|
||||
|
||||
String identifier() {
|
||||
return "dummy";
|
||||
}
|
||||
|
||||
Color backgroundMainColor() {
|
||||
return red;
|
||||
}
|
||||
|
@ -304,9 +309,15 @@ abstract class OpaqueThemeType {
|
|||
|
||||
// ... more to come
|
||||
|
||||
// Sizes
|
||||
|
||||
double contactOnionTextSize() {
|
||||
return 18;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CwtchDark extends OpaqueThemeType {
|
||||
class OpaqueDark extends OpaqueThemeType {
|
||||
static final Color darkGreyPurple = Color(0xFF281831);
|
||||
static final Color deepPurple = Color(0xFF422850);
|
||||
static final Color mauvePurple = Color(0xFF8E64A5);
|
||||
|
@ -319,6 +330,10 @@ class CwtchDark extends OpaqueThemeType {
|
|||
static final Color softGreen = Color(0xFFA0FFB0);
|
||||
static final Color softRed = Color(0xFFFFA0B0);
|
||||
|
||||
String identifier() {
|
||||
return "dark";
|
||||
}
|
||||
|
||||
Color backgroundMainColor() {
|
||||
return darkGreyPurple;
|
||||
}
|
||||
|
@ -612,7 +627,7 @@ class CwtchDark extends OpaqueThemeType {
|
|||
}
|
||||
}
|
||||
|
||||
class CwtchLight extends OpaqueThemeType {
|
||||
class OpaqueLight extends OpaqueThemeType {
|
||||
static final Color whitePurple = Color(0xFFFFFDFF);
|
||||
static final Color softPurple = Color(0xFFFDF3FC);
|
||||
static final Color purple = Color(0xFFDFB9DE);
|
||||
|
@ -625,6 +640,10 @@ class CwtchLight extends OpaqueThemeType {
|
|||
static final Color softGreen = Color(0xFFA0FFB0);
|
||||
static final Color softRed = Color(0xFFFFA0B0);
|
||||
|
||||
String identifier() {
|
||||
return "light";
|
||||
}
|
||||
|
||||
Color backgroundMainColor() {
|
||||
return whitePurple;
|
||||
}
|
||||
|
@ -918,6 +937,99 @@ class CwtchLight extends OpaqueThemeType {
|
|||
}
|
||||
}
|
||||
|
||||
ThemeData mkThemeData(Settings opaque) {
|
||||
return ThemeData(
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
primarySwatch: Colors.red,
|
||||
primaryIconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor(),
|
||||
),
|
||||
primaryColor: opaque.current().backgroundMainColor(),
|
||||
canvasColor: opaque.current().backgroundPaneColor(),
|
||||
backgroundColor: opaque.current().backgroundMainColor(),
|
||||
highlightColor: opaque.current().hilightElementTextColor(),
|
||||
iconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor(),
|
||||
),
|
||||
cardColor: opaque.current().backgroundMainColor(),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: opaque.current().backgroundPaneColor(),
|
||||
titleTextStyle: TextStyle(
|
||||
color: opaque.current().mainTextColor(),
|
||||
),
|
||||
actionsIconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor(),
|
||||
)),
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed, backgroundColor: opaque.current().backgroundHilightElementColor()),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()),
|
||||
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()),
|
||||
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||
padding: MaterialStateProperty.all(EdgeInsets.all(20))),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()),
|
||||
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()),
|
||||
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||
padding: MaterialStateProperty.all(EdgeInsets.all(20)),
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18.0),
|
||||
)),
|
||||
),
|
||||
),
|
||||
scrollbarTheme: ScrollbarThemeData(
|
||||
isAlwaysShown: false, thumbColor: MaterialStateProperty.all(opaque.current().scrollbarActiveColor()), trackColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor())),
|
||||
tabBarTheme: TabBarTheme(indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor()))),
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: opaque.current().backgroundPaneColor(),
|
||||
titleTextStyle: TextStyle(color: opaque.current().mainTextColor()),
|
||||
contentTextStyle: TextStyle(color: opaque.current().mainTextColor())),
|
||||
textTheme: TextTheme(
|
||||
headline1: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline2: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline3: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline4: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline5: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline6: TextStyle(color: opaque.current().mainTextColor()),
|
||||
bodyText1: TextStyle(color: opaque.current().mainTextColor()),
|
||||
bodyText2: TextStyle(color: opaque.current().mainTextColor()),
|
||||
subtitle1: TextStyle(color: opaque.current().mainTextColor()),
|
||||
subtitle2: TextStyle(color: opaque.current().mainTextColor()),
|
||||
caption: TextStyle(color: opaque.current().mainTextColor()),
|
||||
button: TextStyle(color: opaque.current().mainTextColor()),
|
||||
overline: TextStyle(color: opaque.current().mainTextColor())),
|
||||
switchTheme: SwitchThemeData(
|
||||
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||
thumbColor: MaterialStateProperty.all(opaque.current().mainTextColor()),
|
||||
trackColor: MaterialStateProperty.all(opaque.current().dropShadowColor()),
|
||||
),
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(backgroundColor: opaque.current().defaultButtonColor(), hoverColor: opaque.current().defaultButtonActiveColor()),
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
cursorColor: opaque.current().defaultButtonActiveColor(), selectionColor: opaque.current().defaultButtonActiveColor(), selectionHandleColor: opaque.current().defaultButtonActiveColor()),
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
OpaqueThemeType _current = CwtchDark();
|
||||
|
||||
void setDark() {
|
||||
_current = CwtchDark();
|
||||
}
|
||||
|
||||
void setLight() {
|
||||
_current = CwtchLight();
|
||||
}
|
||||
|
||||
OpaqueThemeType current() {
|
||||
if (_current == null) {
|
||||
setDark();
|
||||
}
|
||||
return _current;
|
||||
}
|
||||
|
||||
class Opaque extends OpaqueThemeType {
|
||||
Color backgroundMainColor() {
|
||||
return current().backgroundMainColor();
|
||||
|
@ -1226,22 +1338,9 @@ class Opaque extends OpaqueThemeType {
|
|||
}
|
||||
|
||||
static late OpaqueThemeType _current;
|
||||
static final OpaqueThemeType dark = CwtchDark();
|
||||
static final OpaqueThemeType light = CwtchLight();
|
||||
static void setDark() {
|
||||
_current = dark;
|
||||
}
|
||||
//static final OpaqueThemeType dark = CwtchDark();
|
||||
//static final OpaqueThemeType light = CwtchLight();
|
||||
|
||||
static void setLight() {
|
||||
_current = light;
|
||||
}
|
||||
|
||||
static OpaqueThemeType current() {
|
||||
if (_current == null) {
|
||||
setDark();
|
||||
}
|
||||
return _current;
|
||||
}
|
||||
|
||||
int scale = 2;
|
||||
static final String gcdOS = "linux";
|
||||
|
@ -1341,76 +1440,4 @@ class Opaque extends OpaqueThemeType {
|
|||
}
|
||||
}
|
||||
|
||||
ThemeData mkThemeData(Settings opaque) {
|
||||
return ThemeData(
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
primarySwatch: Colors.red,
|
||||
primaryIconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor(),
|
||||
),
|
||||
primaryColor: opaque.current().backgroundMainColor(),
|
||||
canvasColor: opaque.current().backgroundPaneColor(),
|
||||
backgroundColor: opaque.current().backgroundMainColor(),
|
||||
highlightColor: opaque.current().hilightElementTextColor(),
|
||||
iconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor(),
|
||||
),
|
||||
cardColor: opaque.current().backgroundMainColor(),
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: opaque.current().backgroundPaneColor(),
|
||||
titleTextStyle: TextStyle(
|
||||
color: opaque.current().mainTextColor(),
|
||||
),
|
||||
actionsIconTheme: IconThemeData(
|
||||
color: opaque.current().mainTextColor(),
|
||||
)),
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed, backgroundColor: opaque.current().backgroundHilightElementColor()),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()),
|
||||
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()),
|
||||
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||
padding: MaterialStateProperty.all(EdgeInsets.all(20))),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()),
|
||||
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()),
|
||||
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||
padding: MaterialStateProperty.all(EdgeInsets.all(20)),
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18.0),
|
||||
)),
|
||||
),
|
||||
),
|
||||
scrollbarTheme: ScrollbarThemeData(
|
||||
isAlwaysShown: false, thumbColor: MaterialStateProperty.all(opaque.current().scrollbarActiveColor()), trackColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor())),
|
||||
tabBarTheme: TabBarTheme(indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor()))),
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: opaque.current().backgroundPaneColor(),
|
||||
titleTextStyle: TextStyle(color: opaque.current().mainTextColor()),
|
||||
contentTextStyle: TextStyle(color: opaque.current().mainTextColor())),
|
||||
textTheme: TextTheme(
|
||||
headline1: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline2: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline3: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline4: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline5: TextStyle(color: opaque.current().mainTextColor()),
|
||||
headline6: TextStyle(color: opaque.current().mainTextColor()),
|
||||
bodyText1: TextStyle(color: opaque.current().mainTextColor()),
|
||||
bodyText2: TextStyle(color: opaque.current().mainTextColor()),
|
||||
subtitle1: TextStyle(color: opaque.current().mainTextColor()),
|
||||
subtitle2: TextStyle(color: opaque.current().mainTextColor()),
|
||||
caption: TextStyle(color: opaque.current().mainTextColor()),
|
||||
button: TextStyle(color: opaque.current().mainTextColor()),
|
||||
overline: TextStyle(color: opaque.current().mainTextColor())),
|
||||
switchTheme: SwitchThemeData(
|
||||
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||
thumbColor: MaterialStateProperty.all(opaque.current().mainTextColor()),
|
||||
trackColor: MaterialStateProperty.all(opaque.current().dropShadowColor()),
|
||||
),
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(backgroundColor: opaque.current().defaultButtonColor(), hoverColor: opaque.current().defaultButtonActiveColor()),
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
cursorColor: opaque.current().defaultButtonActiveColor(), selectionColor: opaque.current().defaultButtonActiveColor(), selectionHandleColor: opaque.current().defaultButtonActiveColor()),
|
||||
);
|
||||
}
|
||||
*/
|
|
@ -24,13 +24,13 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
/// Set the dark theme.
|
||||
void setDark() {
|
||||
theme = Opaque.dark;
|
||||
theme = OpaqueDark();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Set the Light theme.
|
||||
void setLight() {
|
||||
theme = Opaque.light;
|
||||
theme = OpaqueLight();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
@ -140,10 +140,7 @@ class Settings extends ChangeNotifier {
|
|||
/// Convert this Settings object to a JSON representation for serialization on the
|
||||
/// event bus.
|
||||
dynamic asJson() {
|
||||
var themeString = "light";
|
||||
if (theme == Opaque.dark) {
|
||||
themeString = "dark";
|
||||
}
|
||||
var themeString = theme.identifier();
|
||||
|
||||
return {
|
||||
"Locale": this.locale.languageCode,
|
||||
|
|
|
@ -64,7 +64,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
|||
}).toList())),
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context)!.settingTheme, style: TextStyle(color: settings.current().mainTextColor())),
|
||||
value: settings.current() == Opaque.light,
|
||||
value: settings.current() == "light",
|
||||
onChanged: (bool value) {
|
||||
if (value) {
|
||||
settings.setLight();
|
||||
|
|
|
@ -31,7 +31,7 @@ class _ContactRowState extends State<ContactRow> {
|
|||
diameter: 64.0,
|
||||
imagePath: contact.imagePath,
|
||||
maskOut: !contact.isOnline(),
|
||||
border: contact.isOnline() ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor()),
|
||||
border: contact.isOnline() ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : contact.isBlocked ? Provider.of<Settings>(context).theme.portraitBlockedBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor()),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
|
@ -41,11 +41,14 @@ class _ContactRowState extends State<ContactRow> {
|
|||
children: [
|
||||
Text(
|
||||
contact.nickname, //(contact.isInvitation ? "invite " : "non-invite ") + (contact.isBlocked ? "blokt" : "nonblokt"),//
|
||||
style: Provider.of<FlwtchState>(context).biggerFont,
|
||||
|
||||
style: TextStyle(fontSize: Provider.of<Settings>(context).theme.contactOnionTextSize(),
|
||||
color: contact.isBlocked ? Provider.of<Settings>(context).theme.portraitBlockedTextColor() : Provider.of<Settings>(context).theme.mainTextColor()), //Provider.of<FlwtchState>(context).biggerFont,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
Text(contact.onion),
|
||||
Text(contact.onion,
|
||||
style: TextStyle(color: contact.isBlocked ? Provider.of<Settings>(context).theme.portraitBlockedTextColor() : Provider.of<Settings>(context).theme.mainTextColor())),
|
||||
],
|
||||
))),
|
||||
Padding(
|
||||
|
|
|
@ -38,7 +38,7 @@ class _ProfileImageState extends State<ProfileImage> {
|
|||
filterQuality: FilterQuality.medium,
|
||||
// We need some theme specific blending here...we might want to consider making this a theme level attribute
|
||||
colorBlendMode: !widget.maskOut
|
||||
? Provider.of<Settings>(context).theme == Opaque.dark
|
||||
? Provider.of<Settings>(context).theme.identifier() == "dark"
|
||||
? BlendMode.softLight
|
||||
: BlendMode.darken
|
||||
: BlendMode.srcOut,
|
||||
|
|
|
@ -14,8 +14,8 @@ import 'package:provider/provider.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), Opaque.dark);
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), Opaque.light);
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), OpaqueDark());
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), OpaqueLight());
|
||||
ChangeNotifierProvider<Settings> getSettingsEnglishDark() => ChangeNotifierProvider.value(value: settingsEnglishDark);
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -14,8 +14,8 @@ import 'package:provider/provider.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), Opaque.dark);
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), Opaque.light);
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), OpaqueDark());
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), OpaqueLight());
|
||||
ChangeNotifierProvider<Settings> getSettingsEnglishDark() => ChangeNotifierProvider.value(value: settingsEnglishDark);
|
||||
|
||||
void main() {
|
||||
|
|
|
@ -14,8 +14,8 @@ import 'package:provider/provider.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), Opaque.dark);
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), Opaque.light);
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), OpaqueDark());
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), OpaqueLight());
|
||||
ChangeNotifierProvider<Settings> getSettingsEnglishDark() => ChangeNotifierProvider.value(value: settingsEnglishDark);
|
||||
|
||||
String file(String slug) {
|
||||
|
|
|
@ -14,8 +14,8 @@ import 'package:provider/provider.dart';
|
|||
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), Opaque.dark);
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), Opaque.light);
|
||||
var settingsEnglishDark = Settings(Locale("en", ''), OpaqueDark());
|
||||
var settingsEnglishLight = Settings(Locale("en", ''), OpaqueLight());
|
||||
ChangeNotifierProvider<Settings> getSettingsEnglishDark() => ChangeNotifierProvider.value(value: settingsEnglishDark);
|
||||
|
||||
String file(String slug) {
|
||||
|
|
Loading…
Reference in New Issue