refactor: replace deprecated methods
This commit is contained in:
parent
5635238921
commit
c5ea37f9bd
|
@ -84,7 +84,7 @@ class AuthModel with ChangeNotifier {
|
|||
|
||||
// https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow
|
||||
Future<void> _onSchemeDetected(Uri? uri) async {
|
||||
await closeWebView();
|
||||
await closeInAppWebView();
|
||||
|
||||
loading = true;
|
||||
notifyListeners();
|
||||
|
@ -143,9 +143,7 @@ class AuthModel with ChangeNotifier {
|
|||
throw info['message'];
|
||||
}
|
||||
if (info['error'] != null) {
|
||||
throw info['error'] +
|
||||
'. ' +
|
||||
(info['error_description'] ?? '');
|
||||
throw info['error'] + '. ' + (info['error_description'] ?? '');
|
||||
}
|
||||
final user = GitlabUser.fromJson(info);
|
||||
await _addAccount(Account(
|
||||
|
@ -693,15 +691,15 @@ class AuthModel with ChangeNotifier {
|
|||
Client? _gqlClient;
|
||||
Client get gqlClient {
|
||||
_gqlClient ??= Client(
|
||||
link: HttpLink(
|
||||
'$_apiPrefix/graphql',
|
||||
defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'},
|
||||
),
|
||||
// https://ferrygraphql.com/docs/fetch-policies#default-fetchpolicies
|
||||
defaultFetchPolicies: {
|
||||
OperationType.query: FetchPolicy.NetworkOnly,
|
||||
},
|
||||
);
|
||||
link: HttpLink(
|
||||
'$_apiPrefix/graphql',
|
||||
defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'},
|
||||
),
|
||||
// https://ferrygraphql.com/docs/fetch-policies#default-fetchpolicies
|
||||
defaultFetchPolicies: {
|
||||
OperationType.query: FetchPolicy.NetworkOnly,
|
||||
},
|
||||
);
|
||||
|
||||
return _gqlClient!;
|
||||
}
|
||||
|
|
|
@ -96,8 +96,8 @@ class GithubPalette {
|
|||
// final pageSize = 5;
|
||||
const PAGE_SIZE = 30;
|
||||
|
||||
var createWarning =
|
||||
(String text) => Text(text, style: const TextStyle(color: Colors.redAccent));
|
||||
var createWarning = (String text) =>
|
||||
Text(text, style: const TextStyle(color: Colors.redAccent));
|
||||
var warningSpan =
|
||||
const TextSpan(text: 'xxx', style: TextStyle(color: Colors.redAccent));
|
||||
|
||||
|
@ -169,8 +169,9 @@ class PrimerBranchName extends StatelessWidget {
|
|||
launchStringUrl(String? url) async {
|
||||
if (url == null) return;
|
||||
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
final uri = Uri.parse(url);
|
||||
if (await canLaunchUrl(uri)) {
|
||||
await launchUrl(uri);
|
||||
} else {
|
||||
// TODO: fallback
|
||||
}
|
||||
|
|
|
@ -7,10 +7,8 @@ import 'package:webview_flutter/webview_flutter.dart';
|
|||
class HtmlView extends StatefulWidget {
|
||||
final String html;
|
||||
HtmlView(String text, {String? cssText, List<String> cssLinks = const []})
|
||||
: html = '<meta name="viewport" content="width=device-width">${cssLinks
|
||||
.map((link) =>
|
||||
'<link rel="stylesheet" href="$link" crossorigin="anonymous" />')
|
||||
.join('')}<style>body{margin:12px}${cssText ?? ''}</style>$text';
|
||||
: html =
|
||||
'<meta name="viewport" content="width=device-width">${cssLinks.map((link) => '<link rel="stylesheet" href="$link" crossorigin="anonymous" />').join('')}<style>body{margin:12px}${cssText ?? ''}</style>$text';
|
||||
|
||||
@override
|
||||
_HtmlViewState createState() => _HtmlViewState();
|
||||
|
@ -24,7 +22,7 @@ class _HtmlViewState extends State<HtmlView> {
|
|||
|
||||
updateHeight() async {
|
||||
final value = await controller
|
||||
.evaluateJavascript("document.documentElement.scrollHeight;");
|
||||
.runJavascriptReturningResult("document.documentElement.scrollHeight;");
|
||||
// print(value);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
|
|
Loading…
Reference in New Issue