apex_flutter_plugin 1.0.10
apex_flutter_plugin: ^1.0.10 copied to clipboard
ApexTeam Flutter Plugin - A simple flutter plugin for ApexTeam fellas which supports http request management, request encryption, request cancellation, ... .
example/lib/main.dart
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:quill_delta/quill_delta.dart';
import 'package:zefyr_nitro/zefyr.dart';
import 'AttrDelegate.dart';
import 'CustomImageDeligate.dart';
void main() {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
runApp(MaterialApp(
theme: ThemeData(fontFamily: 'IRANSans'),
home: MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _fingerprint = 'Unknown';
String _androidId = 'Unknown';
String _hashUID = 'Unknown';
@override
void initState() {
// Api.shared.config = ApiConfig(
// "https://jsonplaceholder.typicode.com/posts/1",
// encrypt: false,
// debugMode: true,
// secretKey: Constants.CRYPTO_SECRET_KEY);
super.initState();
// initPlatformState();
}
// Future<void> initPlatformState() async {
// String fingerprint, androidId, hashUID;
// try {
// fingerprint = await ApexFlutterPlugin.fingerprint();
// androidId = await ApexFlutterPlugin.androidId();
// hashUID = await ApexFlutterPlugin.hashUID();
// } on PlatformException {
// fingerprint = 'Failed to get fingerprint.';
// }
// if (!mounted) return;
//
// setState(() {
// _fingerprint = fingerprint;
// _androidId = androidId;
// _hashUID = hashUID;
// });
// }
String _text = "wtf";
int _index = 0;
Delta getDelta(String doc) {
return Delta.fromJson(json.decode(utf8.decode(base64Decode(doc))) as List);
}
@override
Widget build(BuildContext context) {
var _fontStyle =
TextStyle(fontFamily: "IRANSans", fontSize: 16, color: Colors.black);
var _codeStyle = TextStyle(
fontFamily: "IRANSans",
fontSize: 18 * 6 / 7,
decorationStyle: TextDecorationStyle.dashed,
locale: Locale("en"),
);
var _linkStyle = TextStyle(color: Colors.blue);
var _quoteStyle = TextStyle(color: Colors.blueGrey);
return Scaffold(
body: ListView(
children: [
Directionality(
textDirection: TextDirection.rtl,
child: ZefyrTheme(
data: ZefyrThemeData(
attributeTheme: AttributeTheme(
bold: _fontStyle,
italic: _fontStyle,
numberList: BlockTheme(textStyle: _fontStyle),
heading3: LineTheme(
padding: EdgeInsets.only(top: 10),
textStyle: _fontStyle),
heading2: LineTheme(
padding: EdgeInsets.only(top: 10),
textStyle: _fontStyle),
heading1: LineTheme(
padding: EdgeInsets.only(top: 10),
textStyle: _fontStyle),
bulletList: BlockTheme(textStyle: _fontStyle),
quote: BlockTheme(
textStyle: _quoteStyle,
),
link: _linkStyle,
code: BlockTheme(textStyle: _codeStyle)),
indentWidth: 16,
defaultLineTheme: LineTheme(
textStyle: _fontStyle,
padding: EdgeInsets.only(top: 10, bottom: 5),
)),
child: ZefyrView(
attrDelegate: CustomAttrDelegate(),
document: NotusDocument.fromDelta(getDelta(
"W3siaW5zZXJ0IjoiVWRoZGJk2KjYqtio2KrbjNiq24zZiFxu2K7YqNiu2KjYqtiq2KjYp9uMZGhoZHZkIGQgaGRqZGhkYiBkIGhkaGRoZCJ9LHsiaW5zZXJ0IjoiXG4iLCJhdHRyaWJ1dGVzIjp7ImJsb2NrIjoiY29kZSJ9fSx7Imluc2VydCI6ImhkaGRuIn0seyJpbnNlcnQiOiJcbiIsImF0dHJpYnV0ZXMiOnsiYmxvY2siOiJxdW90ZSJ9fSx7Imluc2VydCI6ImtkamQiLCJhdHRyaWJ1dGVzIjp7ImEiOiJodHRwczovL2dvb2dsZS5jb20ifX0seyJpbnNlcnQiOiJcbiJ9XQ==")),
imageDelegate: CustomImageDelegate(onImageClick: (url) {}),
),
),
),
],
// RaisedButton(
// onPressed: () {
// CancellationToken token = new CancellationToken();
// Api.shared
// .makeRequest(Request(null, method: Method.GET),
// cancelToken: token)
// .then((response) {
// setState(() {
// _text = response.body;
// });
// token.cancel("cancel this");
// }).catchError((e) {
// if (e is OperationCanceledError) {
// print(e.toString());
// } else if (e is TimeoutException) {
// print(e.toString());
// } else {
// print(e.toString());
// }
// });
// },
// child: Text("FINGERPRINT" +
// _fingerprint +
// "\r\nandroidID" +
// _androidId.length.toString() +
// "\r\nhashUID" +
// _hashUID),
// ),
),
);
}
}