refactor: Add code quality reports

This commit is contained in:
Krille Fear 2021-10-16 09:59:38 +02:00
commit 2f978c5098
17 changed files with 93 additions and 29 deletions

View file

@ -601,7 +601,7 @@ class ChatController extends State<Chat> {
void scrollDown() => scrollController.jumpTo(0);
void onEmojiSelected(category, emoji) {
void onEmojiSelected(_, emoji) {
setState(() => showEmojiPicker = false);
if (emoji == null) return;
// make sure we don't send the same emoji twice
@ -721,7 +721,7 @@ class ChatController extends State<Chat> {
return index + 1;
}
void onInputBarSubmitted(String text) {
void onInputBarSubmitted(_) {
send();
FocusScope.of(context).requestFocus(inputFocus);
}

View file

@ -92,6 +92,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
if (token != null) _loginWithToken(token);
});
}
checkHomeserverAction();
}
@override
@ -104,7 +105,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
/// makes sure that it is prefixed with https. Then it searches for the
/// well-known information and forwards to the login page depending on the
/// login type.
void checkHomeserverAction() async {
Future<void> checkHomeserverAction() async {
_coolDown?.cancel();
try {
if (domain.isEmpty) throw L10n.of(context).changeTheHomeserver;
@ -220,15 +221,9 @@ class HomeserverPickerController extends State<HomeserverPicker> {
void signUpAction() => VRouter.of(context).to('signup');
bool _initialized = false;
@override
Widget build(BuildContext context) {
Matrix.of(context).navigatorContext = context;
if (!_initialized) {
_initialized = true;
checkHomeserverAction();
}
return HomeserverPickerView(this);
}
}

View file

@ -28,7 +28,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
final _audioRecorder = Record();
Amplitude _amplitude;
void startRecording() async {
Future<void> startRecording() async {
try {
final tempDir = await getTemporaryDirectory();
_recordedPath =

View file

@ -124,7 +124,7 @@ class SearchController extends State<Search> {
'user_id': text,
}));
}
setState(() {});
setState(() => null);
}
bool _init = false;

View file

@ -63,8 +63,9 @@ class SearchView extends StatelessWidget {
.toLowerCase()
.contains(controller.controller.text.toLowerCase()),
);
const tabCount = 3;
return DefaultTabController(
length: 3,
length: tabCount,
initialIndex:
controller.controller.text?.startsWith('#') ?? false ? 0 : 1,
child: Scaffold(
@ -171,7 +172,8 @@ class SearchView extends StatelessWidget {
shrinkWrap: true,
padding: const EdgeInsets.all(12),
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 1,
crossAxisSpacing: 16,