forked from cwtch.im/cwtch-ui
flutter format
This commit is contained in:
parent
b29bb1e4dc
commit
abf4d79e80
|
@ -282,8 +282,6 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
this._contacts.updateLastMessageTime(this._contacts._contacts.first.identifier, this._contacts._contacts.first.lastMessageTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Parse out the server list json into our server info state struct...
|
||||
|
|
|
@ -35,7 +35,7 @@ class ProfileServerListState extends ChangeNotifier {
|
|||
// online v offline
|
||||
if (a.status == "Synced" && b.status != "Synced") {
|
||||
return -1;
|
||||
} else if (a.status != "Synced" && b.status == "Synced") {
|
||||
} else if (a.status != "Synced" && b.status == "Synced") {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ class RemoteServerInfoState extends ChangeNotifier {
|
|||
List<ContactInfoState> _groups = [];
|
||||
|
||||
RemoteServerInfoState({required this.onion, required this.identifier, required this.description, required this.status});
|
||||
|
||||
|
||||
void updateDescription(String newDescription) {
|
||||
this.description = newDescription;
|
||||
notifyListeners();
|
||||
|
|
|
@ -37,7 +37,6 @@ class Settings extends ChangeNotifier {
|
|||
bool blockUnknownConnections = false;
|
||||
bool streamerMode = false;
|
||||
|
||||
|
||||
void setTheme(String themeId, String mode) {
|
||||
theme = getTheme(themeId, mode);
|
||||
notifyListeners();
|
||||
|
@ -220,7 +219,6 @@ class Settings extends ChangeNotifier {
|
|||
/// Convert this Settings object to a JSON representation for serialization on the
|
||||
/// event bus.
|
||||
dynamic asJson() {
|
||||
|
||||
return {
|
||||
"Locale": this.locale.languageCode,
|
||||
"Theme": theme.theme,
|
||||
|
|
|
@ -93,7 +93,7 @@ class CwtchLight extends OpaqueThemeType {
|
|||
get backgroundPaneColor => header; //softPurple;
|
||||
get backgroundHilightElementColor => softPurple;
|
||||
get mainTextColor => settings;
|
||||
get sendHintTextColor => purple;
|
||||
get sendHintTextColor => purple;
|
||||
get hilightElementColor => purple; //darkPurple; // todo shouldn't be this, too dark, makes font unreadable
|
||||
get defaultButtonColor => accent; // hotPink;
|
||||
get defaultButtonTextColor => whitePurple; // ?
|
||||
|
@ -118,4 +118,4 @@ class CwtchLight extends OpaqueThemeType {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ class GhostLight extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ class MermaidLight extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ class MidnightLight extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ class Neon1Light extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ class Neon2Light extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ import 'neon2.dart';
|
|||
const mode_light = "light";
|
||||
const mode_dark = "dark";
|
||||
|
||||
final themes = { cwtch_theme: {mode_light: CwtchLight(), mode_dark: CwtchDark()},
|
||||
final themes = {
|
||||
cwtch_theme: {mode_light: CwtchLight(), mode_dark: CwtchDark()},
|
||||
ghost_theme: {mode_light: GhostLight(), mode_dark: GhostDark()},
|
||||
mermaid_theme: {mode_light: MermaidLight(), mode_dark: MermaidDark()},
|
||||
midnight_theme: {mode_light: MidnightLight(), mode_dark: MidnightDark()},
|
||||
|
@ -169,13 +170,10 @@ ThemeData mkThemeData(Settings opaque) {
|
|||
)),
|
||||
),
|
||||
),
|
||||
scrollbarTheme: ScrollbarThemeData(
|
||||
isAlwaysShown: false, thumbColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor)),
|
||||
scrollbarTheme: ScrollbarThemeData(isAlwaysShown: false, thumbColor: 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)),
|
||||
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),
|
||||
|
@ -196,10 +194,7 @@ ThemeData mkThemeData(Settings opaque) {
|
|||
trackColor: MaterialStateProperty.all(opaque.current().dropShadowColor),
|
||||
),
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||
backgroundColor: opaque.current().defaultButtonColor,
|
||||
hoverColor: opaque.current().defaultButtonActiveColor,
|
||||
enableFeedback: true,
|
||||
splashColor: opaque.current().defaultButtonActiveColor),
|
||||
backgroundColor: opaque.current().defaultButtonColor, hoverColor: opaque.current().defaultButtonActiveColor, enableFeedback: true, splashColor: opaque.current().defaultButtonActiveColor),
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
cursorColor: opaque.current().defaultButtonActiveColor, selectionColor: opaque.current().defaultButtonActiveColor, selectionHandleColor: opaque.current().defaultButtonActiveColor),
|
||||
);
|
||||
|
|
|
@ -64,4 +64,4 @@ class PumpkinLight extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ class VampireLight extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ class WitchLight extends CwtchLight {
|
|||
get messageFromMeTextColor => font; //mainTextColor;
|
||||
get messageFromOtherBackgroundColor => peerBubble; //purple;
|
||||
get messageFromOtherTextColor => font; //darkPurple;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
hintText: AppLocalizations.of(context)!.yourDisplayName,
|
||||
validator: (value) {
|
||||
if (value.isEmpty) {
|
||||
return AppLocalizations.of(context)!.displayNameTooltip;
|
||||
return AppLocalizations.of(context)!.displayNameTooltip;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
|
|
@ -86,10 +86,10 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
// Onion
|
||||
Visibility(
|
||||
visible: serverInfoState.onion.isNotEmpty,
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
CwtchLabel(label: AppLocalizations.of(context)!.serverAddress),
|
||||
SelectableText(serverInfoState.onion)
|
||||
])),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [CwtchLabel(label: AppLocalizations.of(context)!.serverAddress), SelectableText(serverInfoState.onion)])),
|
||||
|
||||
// Description
|
||||
Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
|
@ -157,25 +157,18 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
height: 20,
|
||||
),
|
||||
Text(AppLocalizations.of(context)!.serverMetricsLabel, style: Provider.of<FlwtchState>(context).biggerFont),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row( crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(AppLocalizations.of(context)!.serverTotalMessagesLabel),
|
||||
]),
|
||||
Text(serverInfoState.totalMessages.toString())
|
||||
]),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row( crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(AppLocalizations.of(context)!.serverConnectionsLabel),
|
||||
]),
|
||||
Text(serverInfoState.connections.toString())
|
||||
]),
|
||||
|
||||
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(AppLocalizations.of(context)!.serverTotalMessagesLabel),
|
||||
]),
|
||||
Text(serverInfoState.totalMessages.toString())
|
||||
]),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(AppLocalizations.of(context)!.serverConnectionsLabel),
|
||||
]),
|
||||
Text(serverInfoState.connections.toString())
|
||||
]),
|
||||
])),
|
||||
|
||||
// ***** Password *****
|
||||
|
|
|
@ -117,7 +117,7 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
if (Provider.of<Settings>(context, listen: false).isExperimentEnabled(TapirGroupsExperiment) || Provider.of<Settings>(context, listen: false).isExperimentEnabled(ServerManagementExperiment)) {
|
||||
actions.add(IconButton(
|
||||
icon: Icon(CwtchIcons.dns_24px),
|
||||
tooltip: AppLocalizations.of(context)!.manageKnownServersButton,
|
||||
tooltip: AppLocalizations.of(context)!.manageKnownServersButton,
|
||||
onPressed: () {
|
||||
_pushServers();
|
||||
}));
|
||||
|
|
|
@ -91,21 +91,21 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
|||
secondary: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.themeColorLabel),
|
||||
trailing: DropdownButton<String>(
|
||||
value: Provider.of<Settings>(context).theme.theme,
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
settings.setTheme(newValue!, settings.theme.mode);
|
||||
saveSettings(context);
|
||||
});
|
||||
},
|
||||
items: themes.keys.map<DropdownMenuItem<String>>((String themeId) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: themeId,
|
||||
child: Text(getThemeName(context, themeId)),
|
||||
);
|
||||
}).toList()),
|
||||
title: Text(AppLocalizations.of(context)!.themeColorLabel),
|
||||
trailing: DropdownButton<String>(
|
||||
value: Provider.of<Settings>(context).theme.theme,
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
settings.setTheme(newValue!, settings.theme.mode);
|
||||
saveSettings(context);
|
||||
});
|
||||
},
|
||||
items: themes.keys.map<DropdownMenuItem<String>>((String themeId) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: themeId,
|
||||
child: Text(getThemeName(context, themeId)),
|
||||
);
|
||||
}).toList()),
|
||||
leading: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),
|
||||
),
|
||||
ListTile(
|
||||
|
@ -331,15 +331,24 @@ String getLanguageFull(context, String languageCode) {
|
|||
/// Since we don't seem to able to dynamically pull translations, this function maps themes to their names
|
||||
String getThemeName(context, String theme) {
|
||||
switch (theme) {
|
||||
case cwtch_theme: return AppLocalizations.of(context)!.themeNameCwtch;
|
||||
case ghost_theme: return AppLocalizations.of(context)!.themeNameGhost;
|
||||
case mermaid_theme: return AppLocalizations.of(context)!.themeNameMermaid;
|
||||
case midnight_theme: return AppLocalizations.of(context)!.themeNameMidnight;
|
||||
case neon1_theme: return AppLocalizations.of(context)!.themeNameNeon1;
|
||||
case neon2_theme: return AppLocalizations.of(context)!.themeNameNeon2;
|
||||
case pumpkin_theme: return AppLocalizations.of(context)!.themeNamePumpkin;
|
||||
case vampire_theme: return AppLocalizations.of(context)!.themeNameVampire;
|
||||
case witch_theme: return AppLocalizations.of(context)!.themeNameWitch;
|
||||
case cwtch_theme:
|
||||
return AppLocalizations.of(context)!.themeNameCwtch;
|
||||
case ghost_theme:
|
||||
return AppLocalizations.of(context)!.themeNameGhost;
|
||||
case mermaid_theme:
|
||||
return AppLocalizations.of(context)!.themeNameMermaid;
|
||||
case midnight_theme:
|
||||
return AppLocalizations.of(context)!.themeNameMidnight;
|
||||
case neon1_theme:
|
||||
return AppLocalizations.of(context)!.themeNameNeon1;
|
||||
case neon2_theme:
|
||||
return AppLocalizations.of(context)!.themeNameNeon2;
|
||||
case pumpkin_theme:
|
||||
return AppLocalizations.of(context)!.themeNamePumpkin;
|
||||
case vampire_theme:
|
||||
return AppLocalizations.of(context)!.themeNameVampire;
|
||||
case witch_theme:
|
||||
return AppLocalizations.of(context)!.themeNameWitch;
|
||||
}
|
||||
return theme;
|
||||
}
|
||||
|
|
|
@ -314,8 +314,7 @@ class _MessageViewState extends State<MessageView> {
|
|||
children = [composeBox];
|
||||
}
|
||||
|
||||
return Container(
|
||||
color: Provider.of<Settings>(context).theme.backgroundMainColor, child: Column(mainAxisSize: MainAxisSize.min, children: children));
|
||||
return Container(color: Provider.of<Settings>(context).theme.backgroundMainColor, child: Column(mainAxisSize: MainAxisSize.min, children: children));
|
||||
}
|
||||
|
||||
// Send the message if enter is pressed without the shift key...
|
||||
|
|
|
@ -10,14 +10,12 @@ import '../main.dart';
|
|||
import '../model.dart';
|
||||
import '../settings.dart';
|
||||
|
||||
|
||||
class ProfileServersView extends StatefulWidget {
|
||||
@override
|
||||
_ProfileServersView createState() => _ProfileServersView();
|
||||
}
|
||||
|
||||
class _ProfileServersView extends State<ProfileServersView> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
|
@ -25,9 +23,10 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
var knownServers = Provider.of<ProfileInfoState>(context).serverList.servers.map<String>((RemoteServerInfoState remoteServer) { return remoteServer.onion + ".onion"; }).toSet();
|
||||
var importServerList = Provider.of<ServerListState>(context).servers.where((server) => !knownServers.contains(server.onion) ).map<DropdownMenuItem<String>>((ServerInfoState serverInfo) {
|
||||
var knownServers = Provider.of<ProfileInfoState>(context).serverList.servers.map<String>((RemoteServerInfoState remoteServer) {
|
||||
return remoteServer.onion + ".onion";
|
||||
}).toSet();
|
||||
var importServerList = Provider.of<ServerListState>(context).servers.where((server) => !knownServers.contains(server.onion)).map<DropdownMenuItem<String>>((ServerInfoState serverInfo) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: serverInfo.onion,
|
||||
child: Text(
|
||||
|
@ -37,25 +36,22 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
);
|
||||
}).toList();
|
||||
|
||||
importServerList.insert(0, DropdownMenuItem<String>(
|
||||
value: "",
|
||||
child: Text(AppLocalizations.of(context)!.importLocalServerSelectText)));
|
||||
importServerList.insert(0, DropdownMenuItem<String>(value: "", child: Text(AppLocalizations.of(context)!.importLocalServerSelectText)));
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width > 600 ? AppLocalizations.of(context)!.manageKnownServersLong : AppLocalizations.of(context)!.manageKnownServersShort),
|
||||
title: Text(MediaQuery.of(context).size.width > 600 ? AppLocalizations.of(context)!.manageKnownServersLong : AppLocalizations.of(context)!.manageKnownServersShort),
|
||||
),
|
||||
body: Consumer<ProfileInfoState>(builder: (context, profile, child) {
|
||||
body: Consumer<ProfileInfoState>(
|
||||
builder: (context, profile, child) {
|
||||
ProfileServerListState servers = profile.serverList;
|
||||
final tiles = servers.servers.map((RemoteServerInfoState server) {
|
||||
return ChangeNotifierProvider<RemoteServerInfoState>.value(
|
||||
value: server,
|
||||
builder: (context, child) => RepaintBoundary(child: RemoteServerRow()),
|
||||
);
|
||||
},
|
||||
final tiles = servers.servers.map(
|
||||
(RemoteServerInfoState server) {
|
||||
return ChangeNotifierProvider<RemoteServerInfoState>.value(
|
||||
value: server,
|
||||
builder: (context, child) => RepaintBoundary(child: RemoteServerRow()),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final divided = ListTile.divideTiles(
|
||||
|
@ -63,37 +59,31 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
tiles: tiles,
|
||||
).toList();
|
||||
|
||||
final importCard = Card( child: ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.importLocalServerLabel),
|
||||
leading: Icon(CwtchIcons.add_circle_24px , color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
trailing: DropdownButton(
|
||||
onChanged: (String? importServer) {
|
||||
if (importServer!.isNotEmpty) {
|
||||
var server = Provider.of<ServerListState>(context).getServer(importServer)!;
|
||||
showImportConfirm(context, profile.onion, server.onion, server.description, server.serverBundle);
|
||||
}
|
||||
|
||||
},
|
||||
value: "",
|
||||
items: importServerList,
|
||||
|
||||
)));
|
||||
final importCard = Card(
|
||||
child: ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.importLocalServerLabel),
|
||||
leading: Icon(CwtchIcons.add_circle_24px, color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
trailing: DropdownButton(
|
||||
onChanged: (String? importServer) {
|
||||
if (importServer!.isNotEmpty) {
|
||||
var server = Provider.of<ServerListState>(context).getServer(importServer)!;
|
||||
showImportConfirm(context, profile.onion, server.onion, server.description, server.serverBundle);
|
||||
}
|
||||
},
|
||||
value: "",
|
||||
items: importServerList,
|
||||
)));
|
||||
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child:
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(5, 0, 5, 10),
|
||||
padding: EdgeInsets.fromLTRB(5, 0, 5, 10),
|
||||
child: Column(children: [
|
||||
|
||||
if (importServerList.length > 1) importCard,
|
||||
|
||||
Column( children: divided )
|
||||
]))));});
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(5, 0, 5, 10),
|
||||
padding: EdgeInsets.fromLTRB(5, 0, 5, 10),
|
||||
child: Column(children: [if (importServerList.length > 1) importCard, Column(children: divided)]))));
|
||||
});
|
||||
|
||||
return ListView(children: divided);
|
||||
},
|
||||
|
@ -102,7 +92,7 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
|
||||
showImportConfirm(BuildContext context, String profileHandle, String serverHandle, String serverDesc, String bundle) {
|
||||
var serverLabel = serverDesc.isNotEmpty ? serverDesc : serverHandle;
|
||||
serverHandle = serverHandle.substring(0, serverHandle.length-6 ); // remove '.onion'
|
||||
serverHandle = serverHandle.substring(0, serverHandle.length - 6); // remove '.onion'
|
||||
// set up the buttons
|
||||
Widget cancelButton = ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.cancel),
|
||||
|
@ -118,15 +108,9 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
var profile = Provider.of<ProfileInfoState>(context);
|
||||
if (profile.serverList.getServer(serverHandle) != null) {
|
||||
profile.serverList.getServer(serverHandle)?.updateDescription(
|
||||
serverDesc);
|
||||
profile.serverList.getServer(serverHandle)?.updateDescription(serverDesc);
|
||||
|
||||
Provider
|
||||
.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.SetConversationAttribute(profile.onion, profile.serverList
|
||||
.getServer(serverHandle)
|
||||
!.identifier, "server.description", serverDesc);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetConversationAttribute(profile.onion, profile.serverList.getServer(serverHandle)!.identifier, "server.description", serverDesc);
|
||||
}
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
|
@ -149,7 +133,4 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,63 +50,62 @@ class _RemoteServerViewState extends State<RemoteServerView> {
|
|||
Widget build(BuildContext context) {
|
||||
return Consumer3<ProfileInfoState, RemoteServerInfoState, Settings>(builder: (context, profile, serverInfoState, settings, child) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(ctrlrDesc.text.isNotEmpty ? ctrlrDesc.text : serverInfoState.onion)
|
||||
),
|
||||
body: Container(
|
||||
margin: EdgeInsets.fromLTRB(30, 0, 30, 10),
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 10),
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CwtchLabel(label: AppLocalizations.of(context)!.serverAddress),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SelectableText(
|
||||
serverInfoState.onion
|
||||
),
|
||||
appBar: AppBar(title: Text(ctrlrDesc.text.isNotEmpty ? ctrlrDesc.text : serverInfoState.onion)),
|
||||
body: Container(
|
||||
margin: EdgeInsets.fromLTRB(30, 0, 30, 10),
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 10),
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CwtchLabel(label: AppLocalizations.of(context)!.serverAddress),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SelectableText(serverInfoState.onion),
|
||||
|
||||
// Description
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CwtchLabel(label: AppLocalizations.of(context)!.serverDescriptionLabel),
|
||||
Text(AppLocalizations.of(context)!.serverDescriptionDescription),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CwtchButtonTextField(
|
||||
controller: ctrlrDesc,
|
||||
readonly: false,
|
||||
tooltip: AppLocalizations.of(context)!.saveBtn,
|
||||
labelText: AppLocalizations.of(context)!.fieldDescriptionLabel,
|
||||
icon: Icon(Icons.save),
|
||||
onPressed: () {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetConversationAttribute(profile.onion, serverInfoState.identifier, "server.description", ctrlrDesc.text);
|
||||
serverInfoState.updateDescription(ctrlrDesc.text);
|
||||
},
|
||||
),
|
||||
// Description
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CwtchLabel(label: AppLocalizations.of(context)!.serverDescriptionLabel),
|
||||
Text(AppLocalizations.of(context)!.serverDescriptionDescription),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CwtchButtonTextField(
|
||||
controller: ctrlrDesc,
|
||||
readonly: false,
|
||||
tooltip: AppLocalizations.of(context)!.saveBtn,
|
||||
labelText: AppLocalizations.of(context)!.fieldDescriptionLabel,
|
||||
icon: Icon(Icons.save),
|
||||
onPressed: () {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetConversationAttribute(profile.onion, serverInfoState.identifier, "server.description", ctrlrDesc.text);
|
||||
serverInfoState.updateDescription(ctrlrDesc.text);
|
||||
},
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
Padding(padding: EdgeInsets.all(8), child: Text( AppLocalizations.of(context)!.groupsOnThisServerLabel),),
|
||||
Expanded(child: _buildGroupsList(serverInfoState))
|
||||
])));
|
||||
|
||||
});
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Text(AppLocalizations.of(context)!.groupsOnThisServerLabel),
|
||||
),
|
||||
Expanded(child: _buildGroupsList(serverInfoState))
|
||||
])));
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildGroupsList(RemoteServerInfoState serverInfoState) {
|
||||
final tiles = serverInfoState.groups.map((ContactInfoState group) {
|
||||
return ChangeNotifierProvider<ContactInfoState>.value(
|
||||
value: group,
|
||||
builder: (context, child) => RepaintBoundary(child: _buildGroupRow(group)), // ServerRow()),
|
||||
);
|
||||
},
|
||||
final tiles = serverInfoState.groups.map(
|
||||
(ContactInfoState group) {
|
||||
return ChangeNotifierProvider<ContactInfoState>.value(
|
||||
value: group,
|
||||
builder: (context, child) => RepaintBoundary(child: _buildGroupRow(group)), // ServerRow()),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final divided = ListTile.divideTiles(
|
||||
|
@ -126,26 +125,22 @@ class _RemoteServerViewState extends State<RemoteServerView> {
|
|||
Widget _buildGroupRow(ContactInfoState group) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(6.0), //border size
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
group.nickname,
|
||||
style: Provider.of<FlwtchState>(context).biggerFont.apply(color: Provider.of<Settings>(context).theme.portraitOnlineBorderColor),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
child: ExcludeSemantics(
|
||||
child: Text(
|
||||
group.onion,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: Provider.of<Settings>(context).theme.portraitOnlineBorderColor),
|
||||
)))
|
||||
])
|
||||
);
|
||||
child: Column(children: [
|
||||
Text(
|
||||
group.nickname,
|
||||
style: Provider.of<FlwtchState>(context).biggerFont.apply(color: Provider.of<Settings>(context).theme.portraitOnlineBorderColor),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
child: ExcludeSemantics(
|
||||
child: Text(
|
||||
group.onion,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: Provider.of<Settings>(context).theme.portraitOnlineBorderColor),
|
||||
)))
|
||||
]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ class SplashView extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Text(appState.appError == "" ? "Loading Cwtch..." : appState.appError,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0, color: appState.appError == "" ? Provider.of<Settings>(context).theme.mainTextColor : Provider.of<Settings>(context).theme.textfieldErrorColor)),
|
||||
style: TextStyle(fontSize: 16.0, color: appState.appError == "" ? Provider.of<Settings>(context).theme.mainTextColor : Provider.of<Settings>(context).theme.textfieldErrorColor)),
|
||||
),
|
||||
Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")),
|
||||
])),
|
||||
|
|
|
@ -115,8 +115,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor,
|
||||
border:
|
||||
Border.all(color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor, width: 1),
|
||||
border: Border.all(color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor, width: 1),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(borderRadiousEh),
|
||||
topRight: Radius.circular(borderRadiousEh),
|
||||
|
|
|
@ -97,8 +97,7 @@ class InvitationBubbleState extends State<InvitationBubble> {
|
|||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor,
|
||||
border:
|
||||
Border.all(color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor, width: 1),
|
||||
border: Border.all(color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor, width: 1),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(borderRadiousEh),
|
||||
topRight: Radius.circular(borderRadiousEh),
|
||||
|
|
|
@ -95,9 +95,7 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
child: Container(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: error
|
||||
? malformedColor
|
||||
: (fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor),
|
||||
color: error ? malformedColor : (fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor),
|
||||
border: Border.all(
|
||||
color: error
|
||||
? malformedColor
|
||||
|
|
|
@ -25,8 +25,7 @@ class _MessageBubbleDecoration extends State<MessageBubbleDecoration> {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(widget.prettyDate,
|
||||
style:
|
||||
TextStyle(fontSize: 9.0, color: widget.fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor),
|
||||
style: TextStyle(fontSize: 9.0, color: widget.fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor),
|
||||
textAlign: widget.fromMe ? TextAlign.right : TextAlign.left),
|
||||
!widget.fromMe
|
||||
? SizedBox(width: 1, height: 1)
|
||||
|
|
|
@ -37,64 +37,64 @@ class _MessageListState extends State<MessageList> {
|
|||
child: Container(
|
||||
color: Provider.of<Settings>(context).theme.backgroundMainColor,
|
||||
child: Column(children: [
|
||||
Visibility(
|
||||
visible: showMessageWarning,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5.0),
|
||||
color: Provider.of<Settings>(context).theme.defaultButtonActiveColor,
|
||||
child: DefaultTextStyle(
|
||||
style: TextStyle(color: Provider.of<Settings>(context).theme.defaultButtonTextColor),
|
||||
child: showSyncing
|
||||
? Text(AppLocalizations.of(context)!.serverNotSynced, textAlign: TextAlign.center)
|
||||
: showOfflineWarning
|
||||
? Text(Provider.of<ContactInfoState>(context).isGroup ? AppLocalizations.of(context)!.serverConnectivityDisconnected : AppLocalizations.of(context)!.peerOfflineMessage,
|
||||
textAlign: TextAlign.center)
|
||||
// Only show the ephemeral status for peer conversations, not for groups...
|
||||
: (showEphemeralWarning
|
||||
? Text(AppLocalizations.of(context)!.chatHistoryDefault, textAlign: TextAlign.center)
|
||||
:
|
||||
// We are not allowed to put null here, so put an empty text widget
|
||||
Text("")),
|
||||
))),
|
||||
Expanded(
|
||||
child: Container(
|
||||
// Only show broken heart is the contact is offline...
|
||||
decoration: BoxDecoration(
|
||||
image: Provider.of<ContactInfoState>(outerContext).isOnline()
|
||||
? null
|
||||
: DecorationImage(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.center,
|
||||
image: AssetImage("assets/core/negative_heart_512px.png"),
|
||||
colorFilter: ColorFilter.mode(Provider.of<Settings>(context).theme.hilightElementColor, BlendMode.srcIn))),
|
||||
// Don't load messages for syncing server...
|
||||
child: loadMessages
|
||||
? ScrollablePositionedList.builder(
|
||||
itemPositionsListener: widget.scrollListener,
|
||||
itemScrollController: widget.scrollController,
|
||||
initialScrollIndex: initi > 4 ? initi - 4 : 0,
|
||||
itemCount: Provider.of<ContactInfoState>(outerContext).totalMessages,
|
||||
reverse: true, // NOTE: There seems to be a bug in flutter that corrects the mouse wheel scroll, but not the drag direction...
|
||||
itemBuilder: (itemBuilderContext, index) {
|
||||
var profileOnion = Provider.of<ProfileInfoState>(outerContext, listen: false).onion;
|
||||
var contactHandle = Provider.of<ContactInfoState>(outerContext, listen: false).identifier;
|
||||
var messageIndex = index;
|
||||
Visibility(
|
||||
visible: showMessageWarning,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5.0),
|
||||
color: Provider.of<Settings>(context).theme.defaultButtonActiveColor,
|
||||
child: DefaultTextStyle(
|
||||
style: TextStyle(color: Provider.of<Settings>(context).theme.defaultButtonTextColor),
|
||||
child: showSyncing
|
||||
? Text(AppLocalizations.of(context)!.serverNotSynced, textAlign: TextAlign.center)
|
||||
: showOfflineWarning
|
||||
? Text(Provider.of<ContactInfoState>(context).isGroup ? AppLocalizations.of(context)!.serverConnectivityDisconnected : AppLocalizations.of(context)!.peerOfflineMessage,
|
||||
textAlign: TextAlign.center)
|
||||
// Only show the ephemeral status for peer conversations, not for groups...
|
||||
: (showEphemeralWarning
|
||||
? Text(AppLocalizations.of(context)!.chatHistoryDefault, textAlign: TextAlign.center)
|
||||
:
|
||||
// We are not allowed to put null here, so put an empty text widget
|
||||
Text("")),
|
||||
))),
|
||||
Expanded(
|
||||
child: Container(
|
||||
// Only show broken heart is the contact is offline...
|
||||
decoration: BoxDecoration(
|
||||
image: Provider.of<ContactInfoState>(outerContext).isOnline()
|
||||
? null
|
||||
: DecorationImage(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.center,
|
||||
image: AssetImage("assets/core/negative_heart_512px.png"),
|
||||
colorFilter: ColorFilter.mode(Provider.of<Settings>(context).theme.hilightElementColor, BlendMode.srcIn))),
|
||||
// Don't load messages for syncing server...
|
||||
child: loadMessages
|
||||
? ScrollablePositionedList.builder(
|
||||
itemPositionsListener: widget.scrollListener,
|
||||
itemScrollController: widget.scrollController,
|
||||
initialScrollIndex: initi > 4 ? initi - 4 : 0,
|
||||
itemCount: Provider.of<ContactInfoState>(outerContext).totalMessages,
|
||||
reverse: true, // NOTE: There seems to be a bug in flutter that corrects the mouse wheel scroll, but not the drag direction...
|
||||
itemBuilder: (itemBuilderContext, index) {
|
||||
var profileOnion = Provider.of<ProfileInfoState>(outerContext, listen: false).onion;
|
||||
var contactHandle = Provider.of<ContactInfoState>(outerContext, listen: false).identifier;
|
||||
var messageIndex = index;
|
||||
|
||||
return FutureBuilder(
|
||||
future: messageHandler(outerContext, profileOnion, contactHandle, messageIndex),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
var message = snapshot.data as Message;
|
||||
var key = Provider.of<ContactInfoState>(outerContext, listen: false).getMessageKey(contactHandle, message.getMetadata().messageID);
|
||||
return message.getWidget(context, key);
|
||||
} else {
|
||||
return MessageLoadingBubble();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
: null))
|
||||
])));
|
||||
return FutureBuilder(
|
||||
future: messageHandler(outerContext, profileOnion, contactHandle, messageIndex),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
var message = snapshot.data as Message;
|
||||
var key = Provider.of<ContactInfoState>(outerContext, listen: false).getMessageKey(contactHandle, message.getMetadata().messageID);
|
||||
return message.getWidget(context, key);
|
||||
} else {
|
||||
return MessageLoadingBubble();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
: null))
|
||||
])));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,9 +90,7 @@ class QuotedMessageBubbleState extends State<QuotedMessageBubble> {
|
|||
child: Container(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: error
|
||||
? malformedColor
|
||||
: (fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor),
|
||||
color: error ? malformedColor : (fromMe ? Provider.of<Settings>(context).theme.messageFromMeBackgroundColor : Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor),
|
||||
border: Border.all(
|
||||
color: error
|
||||
? malformedColor
|
||||
|
|
|
@ -23,46 +23,42 @@ class _RemoteServerRowState extends State<RemoteServerRow> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var server = Provider.of<RemoteServerInfoState>(context);
|
||||
var description = server.description.isNotEmpty ? server.description : server.onion;
|
||||
var description = server.description.isNotEmpty ? server.description : server.onion;
|
||||
var running = server.status == "Synced";
|
||||
return Consumer<ProfileInfoState>(
|
||||
builder: (context, profile, child) {
|
||||
return Card(clipBehavior: Clip.antiAlias,
|
||||
return Consumer<ProfileInfoState>(builder: (context, profile, child) {
|
||||
return Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.all(0.0),
|
||||
child: InkWell(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(6.0), //border size
|
||||
child: Icon(CwtchIcons.dns_24px,
|
||||
color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor, size: 64)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(6.0), //border size
|
||||
child: Icon(CwtchIcons.dns_24px,
|
||||
color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor,
|
||||
size: 64)
|
||||
|
||||
Text(
|
||||
description,
|
||||
semanticsLabel: description,
|
||||
style: Provider.of<FlwtchState>(context)
|
||||
.biggerFont
|
||||
.apply(color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
description,
|
||||
semanticsLabel: description,
|
||||
style: Provider.of<FlwtchState>(context).biggerFont.apply(color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
child: ExcludeSemantics(
|
||||
child: Text(
|
||||
server.onion,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
)))
|
||||
],
|
||||
)),
|
||||
|
||||
]),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
child: ExcludeSemantics(
|
||||
child: Text(
|
||||
server.onion,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
)))
|
||||
],
|
||||
)),
|
||||
]),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(MaterialPageRoute<void>(
|
||||
settings: RouteSettings(name: "remoteserverview"),
|
||||
|
@ -72,7 +68,7 @@ class _RemoteServerRowState extends State<RemoteServerRow> {
|
|||
child: RemoteServerView(),
|
||||
);
|
||||
}));
|
||||
}
|
||||
));});
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,58 +26,57 @@ class _ServerRowState extends State<ServerRow> {
|
|||
margin: EdgeInsets.all(0.0),
|
||||
child: InkWell(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(6.0), //border size
|
||||
child: Icon(CwtchIcons.dns_24px,
|
||||
color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor, size: 64)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
server.description,
|
||||
semanticsLabel: server.description,
|
||||
style: Provider.of<FlwtchState>(context)
|
||||
.biggerFont
|
||||
.apply(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
child: ExcludeSemantics(
|
||||
child: Text(
|
||||
server.onion,
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(6.0), //border size
|
||||
child: Icon(CwtchIcons.dns_24px,
|
||||
color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor, size: 64)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
server.description,
|
||||
semanticsLabel: server.description,
|
||||
style: Provider.of<FlwtchState>(context)
|
||||
.biggerFont
|
||||
.apply(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
)))
|
||||
],
|
||||
)),
|
||||
),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
child: ExcludeSemantics(
|
||||
child: Text(
|
||||
server.onion,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
|
||||
)))
|
||||
],
|
||||
)),
|
||||
|
||||
// Copy server button
|
||||
IconButton(
|
||||
enableFeedback: true,
|
||||
tooltip: AppLocalizations.of(context)!.copyServerKeys,
|
||||
icon: Icon(CwtchIcons.address_copy_2, color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
onPressed: () {
|
||||
Clipboard.setData(new ClipboardData(text: server.serverBundle));
|
||||
},
|
||||
),
|
||||
// Copy server button
|
||||
IconButton(
|
||||
enableFeedback: true,
|
||||
tooltip: AppLocalizations.of(context)!.copyServerKeys,
|
||||
icon: Icon(CwtchIcons.address_copy_2, color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
onPressed: () {
|
||||
Clipboard.setData(new ClipboardData(text: server.serverBundle));
|
||||
},
|
||||
),
|
||||
|
||||
// Edit button
|
||||
IconButton(
|
||||
enableFeedback: true,
|
||||
tooltip: AppLocalizations.of(context)!.editServerTitle,
|
||||
icon: Icon(Icons.create, color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
onPressed: () {
|
||||
// Edit button
|
||||
IconButton(
|
||||
enableFeedback: true,
|
||||
tooltip: AppLocalizations.of(context)!.editServerTitle,
|
||||
icon: Icon(Icons.create, color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
onPressed: () {
|
||||
_pushEditServer(server);
|
||||
},
|
||||
)
|
||||
]),
|
||||
onTap: () {
|
||||
_pushEditServer(server);
|
||||
},
|
||||
)
|
||||
]),
|
||||
onTap: () {
|
||||
_pushEditServer(server);
|
||||
}
|
||||
));
|
||||
}));
|
||||
}
|
||||
|
||||
void _pushEditServer(ServerInfoState server) {
|
||||
|
|
|
@ -47,7 +47,6 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
|
|||
filled: true,
|
||||
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0)),
|
||||
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)),
|
||||
|
||||
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)),
|
||||
errorStyle: TextStyle(
|
||||
color: theme.current().textfieldErrorColor,
|
||||
|
|
Loading…
Reference in New Issue