apex_flutter_plugin 2.0.3
apex_flutter_plugin: ^2.0.3 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:apex_flutter_plugin/api/api.dart';
import 'package:apex_flutter_plugin/api/config.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:quill_delta/quill_delta.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(
'',
encrypt: false,
debugMode: true);
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: () async {
var file =
await ImagePicker.pickImage(source: ImageSource.gallery);
Api.shared.uploadFile('file', file.path, url: 'https://gooyaan.ir/uploadFile.php').then((
response) {
setState(() {
_text = response.body;
});
});
},
child: Text("FINGERPRINT" +
_fingerprint +
"\r\nandroidID" +
_androidId.length.toString() +
"\r\nhashUID" +
_hashUID),
),
],
),
);
}
}