mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-08 01:05:02 -04:00
lint cleanup
This commit is contained in:
parent
fe9d9f8aca
commit
9fa1666e8b
22 changed files with 178 additions and 155 deletions
|
@ -23,25 +23,25 @@ Future<void> setupDesktopWindow() async {
|
|||
}
|
||||
}
|
||||
|
||||
void enableTitleBar(bool enabled) {
|
||||
Future<void> enableTitleBar(bool enabled) async {
|
||||
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
|
||||
if (enabled) {
|
||||
windowManager.setTitleBarStyle(TitleBarStyle.normal);
|
||||
await windowManager.setTitleBarStyle(TitleBarStyle.normal);
|
||||
} else {
|
||||
windowManager.setTitleBarStyle(TitleBarStyle.hidden);
|
||||
await windowManager.setTitleBarStyle(TitleBarStyle.hidden);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void portraitOnly() {
|
||||
SystemChrome.setPreferredOrientations([
|
||||
Future<void> portraitOnly() async {
|
||||
await SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
}
|
||||
|
||||
void landscapeOnly() {
|
||||
SystemChrome.setPreferredOrientations([
|
||||
Future<void> landscapeOnly() async {
|
||||
await SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.landscapeLeft,
|
||||
DeviceOrientation.landscapeRight,
|
||||
]);
|
||||
|
|
|
@ -14,12 +14,13 @@ class ExternalStreamState<T> {
|
|||
streamController.add(newState);
|
||||
}
|
||||
|
||||
AutoDisposeStreamProvider<T> provider() => AutoDisposeStreamProvider<T>((ref) async* {
|
||||
if (await streamController.stream.isEmpty) {
|
||||
yield currentState;
|
||||
}
|
||||
await for (final value in streamController.stream) {
|
||||
yield value;
|
||||
}
|
||||
});
|
||||
AutoDisposeStreamProvider<T> provider() =>
|
||||
AutoDisposeStreamProvider<T>((ref) async* {
|
||||
if (await streamController.stream.isEmpty) {
|
||||
yield currentState;
|
||||
}
|
||||
await for (final value in streamController.stream) {
|
||||
yield value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -275,10 +275,10 @@ Map<String, int> _buildPhonoToByte() {
|
|||
|
||||
String prettyPhonoString(String s,
|
||||
{int wordsPerLine = 5, int phonoPerWord = 2}) {
|
||||
assert(wordsPerLine >= 1);
|
||||
assert(phonoPerWord >= 1);
|
||||
assert(wordsPerLine >= 1, 'Should not have zero or negative words per line');
|
||||
assert(phonoPerWord >= 1, 'Should not have zero or negative phono per word');
|
||||
final cs = canonicalPhonoString(s).toUpperCase();
|
||||
var out = '';
|
||||
final out = StringBuffer();
|
||||
var words = 0;
|
||||
var phonos = 0;
|
||||
for (var i = 0; i < cs.length; i += 3) {
|
||||
|
@ -289,15 +289,15 @@ String prettyPhonoString(String s,
|
|||
words += 1;
|
||||
if (words == wordsPerLine) {
|
||||
words = 0;
|
||||
out += '\n';
|
||||
out.write('\n');
|
||||
} else {
|
||||
out += ' ';
|
||||
out.write(' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
out += cs.substring(i, i + 3);
|
||||
out.write(cs.substring(i, i + 3));
|
||||
}
|
||||
return out;
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
String canonicalPhonoString(String s) {
|
||||
|
@ -334,9 +334,9 @@ Uint8List decodePhono(String s) {
|
|||
}
|
||||
|
||||
String encodePhono(Uint8List b) {
|
||||
var out = '';
|
||||
final out = StringBuffer();
|
||||
for (var i = 0; i < b.length; i++) {
|
||||
out += _byteToPhono[b[i]];
|
||||
out.write(_byteToPhono[b[i]]);
|
||||
}
|
||||
return out;
|
||||
return out.toString();
|
||||
}
|
||||
|
|
|
@ -13,4 +13,5 @@ Future<Uint8List> protobufUpdateBytes<T extends GeneratedMessage>(
|
|||
|
||||
Future<Uint8List> Function(Uint8List)
|
||||
protobufUpdate<T extends GeneratedMessage>(
|
||||
T Function(List<int>) fromBuffer, Future<T> Function(T) update) => (oldBytes) => protobufUpdateBytes(fromBuffer, oldBytes, update);
|
||||
T Function(List<int>) fromBuffer, Future<T> Function(T) update) =>
|
||||
(oldBytes) => protobufUpdateBytes(fromBuffer, oldBytes, update);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue