forked from firka/firka
settings: add logout button
This commit is contained in:
4
firka/assets/icons/group.svg
Normal file
4
firka/assets/icons/group.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.44866 0.51265C7.82192 0.400678 8.21619 0.377515 8.59999 0.44501C8.98379 0.512504 9.3465 0.668787 9.65917 0.901383C9.97183 1.13398 10.2258 1.43645 10.4008 1.78464C10.5758 2.13284 10.6669 2.51712 10.667 2.90682V15.0935C10.6669 15.4832 10.5758 15.8675 10.4008 16.2157C10.2258 16.5639 9.97183 16.8663 9.65917 17.0989C9.3465 17.3315 8.98379 17.4878 8.59999 17.5553C8.21619 17.6228 7.82192 17.5996 7.44866 17.4876L2.44866 15.9876C1.93374 15.8332 1.48233 15.5169 1.16139 15.0856C0.840454 14.6543 0.66708 14.1311 0.666992 13.5935V4.40682C0.66708 3.86923 0.840454 3.34599 1.16139 2.91472C1.48233 2.48345 1.93374 2.16712 2.44866 2.01265L7.44866 0.51265ZM11.5003 2.33348C11.5003 2.11247 11.5881 1.90051 11.7444 1.74423C11.9007 1.58795 12.1126 1.50015 12.3337 1.50015H14.8337C15.4967 1.50015 16.1326 1.76354 16.6014 2.23238C17.0703 2.70122 17.3337 3.33711 17.3337 4.00015V4.83348C17.3337 5.0545 17.2459 5.26646 17.0896 5.42274C16.9333 5.57902 16.7213 5.66682 16.5003 5.66682C16.2793 5.66682 16.0673 5.57902 15.9111 5.42274C15.7548 5.26646 15.667 5.0545 15.667 4.83348V4.00015C15.667 3.77914 15.5792 3.56717 15.4229 3.41089C15.2666 3.25461 15.0547 3.16682 14.8337 3.16682H12.3337C12.1126 3.16682 11.9007 3.07902 11.7444 2.92274C11.5881 2.76646 11.5003 2.5545 11.5003 2.33348ZM16.5003 12.3335C16.7213 12.3335 16.9333 12.4213 17.0896 12.5776C17.2459 12.7338 17.3337 12.9458 17.3337 13.1668V14.0001C17.3337 14.6632 17.0703 15.2991 16.6014 15.7679C16.1326 16.2368 15.4967 16.5001 14.8337 16.5001H12.3337C12.1126 16.5001 11.9007 16.4124 11.7444 16.2561C11.5881 16.0998 11.5003 15.8878 11.5003 15.6668C11.5003 15.4458 11.5881 15.2338 11.7444 15.0776C11.9007 14.9213 12.1126 14.8335 12.3337 14.8335H14.8337C15.0547 14.8335 15.2666 14.7457 15.4229 14.5894C15.5792 14.4331 15.667 14.2212 15.667 14.0001V13.1668C15.667 12.9458 15.7548 12.7338 15.9111 12.5776C16.0673 12.4213 16.2793 12.3335 16.5003 12.3335ZM6.50033 8.16682C6.27931 8.16682 6.06735 8.25461 5.91107 8.41089C5.75479 8.56717 5.66699 8.77914 5.66699 9.00015C5.66699 9.22116 5.75479 9.43312 5.91107 9.58941C6.06735 9.74569 6.27931 9.83348 6.50033 9.83348H6.50116C6.72217 9.83348 6.93413 9.74569 7.09041 9.58941C7.2467 9.43312 7.33449 9.22116 7.33449 9.00015C7.33449 8.77914 7.2467 8.56717 7.09041 8.41089C6.93413 8.25461 6.72217 8.16682 6.50116 8.16682H6.50033Z" fill="#A7DC22"/>
|
||||
<path d="M12.334 8.99967H16.5007M16.5007 8.99967L14.834 7.33301M16.5007 8.99967L14.834 10.6663" stroke="#A7DC22" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
Submodule firka/lib/l10n updated: cd7441937f...2d4754563d
@@ -3,14 +3,17 @@ import 'dart:io';
|
||||
|
||||
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
|
||||
import 'package:firka/helpers/db/models/app_settings_model.dart';
|
||||
import 'package:firka/helpers/db/models/token_model.dart';
|
||||
import 'package:firka/helpers/image_preloader.dart';
|
||||
import 'package:firka/helpers/ui/firka_button.dart';
|
||||
import 'package:firka/helpers/ui/firka_card.dart';
|
||||
import 'package:firka/main.dart';
|
||||
import 'package:firka/ui/model/style.dart';
|
||||
import 'package:firka/ui/phone/screens/login/login_screen.dart';
|
||||
import 'package:firka/ui/widget/firka_icon.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
@@ -592,6 +595,50 @@ class _SettingsScreenState extends FirkaState<SettingsScreen> {
|
||||
);
|
||||
},
|
||||
));
|
||||
widgets.add(SizedBox(height: 20));
|
||||
widgets.add(GestureDetector(
|
||||
child: FirkaCard(left: [
|
||||
Row(
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.icons,
|
||||
"group",
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
widget.data.l10n.s_acc_logout,
|
||||
style: appStyle.fonts.B_16R
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
)
|
||||
]),
|
||||
onTap: () async {
|
||||
final active = widget.data.client.model.studentIdNorm!;
|
||||
|
||||
await widget.data.isar.writeTxn(() async {
|
||||
await widget.data.isar.tokenModels.delete(active);
|
||||
|
||||
item.accountIndex = 0;
|
||||
await item.save(widget.data.isar.appSettingsModels);
|
||||
});
|
||||
|
||||
final accounts =
|
||||
await widget.data.isar.tokenModels.where().findAll();
|
||||
|
||||
if (accounts.isEmpty) {
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LoginScreen(widget.data)),
|
||||
(route) => false,
|
||||
);
|
||||
} else {
|
||||
widget.data.tokens = accounts;
|
||||
runApp(InitializationScreen());
|
||||
}
|
||||
},
|
||||
));
|
||||
continue;
|
||||
}
|
||||
if (item is SettingsLogs) {
|
||||
|
||||
Reference in New Issue
Block a user