Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sai Srinivas
GEN_ERP_2025
Commits
60c0bef0
Commit
60c0bef0
authored
May 21, 2025
by
Sai Srinivas
Browse files
ios pubspec
parent
ed1a2aea
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/screens/finance/FileViewer.dart
View file @
60c0bef0
...
...
@@ -16,7 +16,7 @@ import '../../Utils/app_colors.dart';
class
Fileviewer
extends
StatefulWidget
{
final
String
fileName
;
final
String
fileUrl
;
const
Fileviewer
({
super
.
key
,
required
this
.
fileName
,
required
this
.
fileUrl
});
const
Fileviewer
({
super
.
key
,
required
this
.
fileName
,
required
this
.
fileUrl
});
@override
State
<
Fileviewer
>
createState
()
=>
_FileviewerState
();
...
...
@@ -24,7 +24,7 @@ class Fileviewer extends StatefulWidget {
class
_FileviewerState
extends
State
<
Fileviewer
>
{
final
Completer
<
InAppWebViewController
>
_controller
=
Completer
<
InAppWebViewController
>();
Completer
<
InAppWebViewController
>();
var
empId
=
""
;
var
sessionId
=
""
;
bool
isLoading
=
true
;
...
...
@@ -49,39 +49,42 @@ class _FileviewerState extends State<Fileviewer> {
throw
'Could not launch
$url
'
;
}
}
var
Finalurl
;
@override
void
initState
()
{
// loadData();
pullToRefreshController
=
kIsWeb
?
null
:
PullToRefreshController
(
settings:
pullToRefreshSettings
,
onRefresh:
()
async
{
if
(
defaultTargetPlatform
==
TargetPlatform
.
android
)
{
webViewController
?.
reload
();
}
else
if
(
defaultTargetPlatform
==
TargetPlatform
.
iOS
)
{
webViewController
?.
loadUrl
(
urlRequest:
URLRequest
(
url:
await
webViewController
?.
getUrl
()));
}
},
);
pullToRefreshController
=
kIsWeb
?
null
:
PullToRefreshController
(
settings:
pullToRefreshSettings
,
onRefresh:
()
async
{
if
(
defaultTargetPlatform
==
TargetPlatform
.
android
)
{
webViewController
?.
reload
();
}
else
if
(
defaultTargetPlatform
==
TargetPlatform
.
iOS
)
{
webViewController
?.
loadUrl
(
urlRequest:
URLRequest
(
url:
await
webViewController
?.
getUrl
(),
),
);
}
},
);
// print("URL:${widget.url}");
super
.
initState
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
resizeToAvoidBottomInset:
true
,
appBar:
appbar
(
context
,
"File Viewer"
),
body:
fileWidget
(
context
),
);
}
Widget
fileWidget
(
BuildContext
context
){
Widget
fileWidget
(
BuildContext
context
)
{
final
extension
=
getFileExtension
(
widget
.
fileName
);
switch
(
extension
)
{
case
'jpg'
:
...
...
@@ -90,29 +93,31 @@ class _FileviewerState extends State<Fileviewer> {
case
'gif'
:
return
CachedNetworkImage
(
imageUrl:
widget
.
fileUrl
,
placeholder:
(
context
,
url
)
=>
const
Center
(
child:
CircularProgressIndicator
()),
placeholder:
(
context
,
url
)
=>
const
Center
(
child:
CircularProgressIndicator
()),
errorWidget:
(
context
,
url
,
error
)
=>
const
Icon
(
Icons
.
error
),
fit:
BoxFit
.
contain
,
);
case
'pdf'
:
return
SfPdfViewer
.
network
(
widget
.
fileUrl
,
key:
GlobalKey
(),
);
return
SfPdfViewer
.
network
(
widget
.
fileUrl
,
key:
GlobalKey
());
case
'doc'
:
case
'docx'
:
case
'xls'
:
case
'xlsx'
:
return
InAppWebView
(
initialUrlRequest:
URLRequest
(
url:
WebUri
(
widget
.
fileUrl
),
)
,
androidOnGeolocationPermissionsShowPrompt:
(
InAppWebViewController
controller
,
String
origin
)
async
{
initialUrlRequest:
URLRequest
(
url:
WebUri
(
widget
.
fileUrl
)),
androidOnGeolocationPermissionsShowPrompt:
(
InAppWebViewController
controller
,
String
origin
,
)
async
{
return
GeolocationPermissionShowPromptResponse
(
origin:
origin
,
allow:
true
,
retain:
true
);
origin:
origin
,
allow:
true
,
retain:
true
,
);
},
initialOptions:
InAppWebViewGroupOptions
(
android:
AndroidInAppWebViewOptions
(
...
...
@@ -123,24 +128,23 @@ class _FileviewerState extends State<Fileviewer> {
allowFileAccess:
true
,
databaseEnabled:
true
,
// Enables the WebView database
domStorageEnabled:
true
,
// Enables DOM storage
builtInZoomControls:
true
,
// Enables the built-in zoom controls
displayZoomControls:
false
,
// Disables displaying zoom controls
builtInZoomControls:
true
,
// Enables the built-in zoom controls
displayZoomControls:
false
,
// Disables displaying zoom controls
safeBrowsingEnabled:
true
,
// Enables Safe Browsing
clearSessionCache:
true
,
),
ios:
IOSInAppWebViewOptions
(
allowsInlineMediaPlayback:
true
,
),
ios:
IOSInAppWebViewOptions
(
allowsInlineMediaPlayback:
true
),
),
androidOnPermissionRequest:
(
InAppWebViewController
controller
,
String
origin
,
List
<
String
>
resources
)
async
{
androidOnPermissionRequest:
(
InAppWebViewController
controller
,
String
origin
,
List
<
String
>
resources
,
)
async
{
return
PermissionRequestResponse
(
resources:
resources
,
action:
PermissionRequestResponseAction
.
GRANT
);
resources:
resources
,
action:
PermissionRequestResponseAction
.
GRANT
,
);
},
onWebViewCreated:
(
controller
)
{
webViewController
=
controller
;
...
...
@@ -170,27 +174,23 @@ class _FileviewerState extends State<Fileviewer> {
if
(
kDebugMode
)
{
debugPrint
(
"consoleMessage
${consoleMessage}
"
);
}
debugPrint
(
"JavaScript console message:
${consoleMessage.message}
"
);
debugPrint
(
"JavaScript console message:
${consoleMessage.message}
"
);
},
);
default
:
return
Container
();
}
}
Future
<
Uint8List
?>
_loadPdf
(
String
url
)
async
{
try
{
final
response
=
await
http
.
get
(
Uri
.
parse
(
url
));
if
(
response
!=
null
){
if
(
response
!=
null
)
{
if
(
response
.
statusCode
==
200
)
{
print
(
response
.
bodyBytes
);
return
response
.
bodyBytes
;
}
}
}
catch
(
e
)
{
print
(
'Error loading PDF:
$e
'
);
}
...
...
pubspec.lock
View file @
60c0bef0
...
...
@@ -37,10 +37,10 @@ packages:
dependency: transitive
description:
name: async
sha256:
d2872f9c1
97
3
1c
2
e5
f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
sha256:
"758e6d74e
971c
3
e5
aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://pub.dev"
source: hosted
version: "2.1
2
.0"
version: "2.1
3
.0"
barcode:
dependency: transitive
description:
...
...
@@ -285,10 +285,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "
6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc
"
sha256: "
5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44
"
url: "https://pub.dev"
source: hosted
version: "1.3.
2
"
version: "1.3.
3
"
ffi:
dependency: transitive
description:
...
...
@@ -924,26 +924,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256:
c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
sha256:
"8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0"
url: "https://pub.dev"
source: hosted
version: "1
0
.0.
8
"
version: "1
1
.0.
1
"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256:
f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
sha256:
"1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://pub.dev"
source: hosted
version: "3.0.
9
"
version: "3.0.
10
"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "
6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3
"
sha256: "
8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1
"
url: "https://pub.dev"
source: hosted
version: "3.0.
1
"
version: "3.0.
2
"
lints:
dependency: transitive
description:
...
...
@@ -1641,10 +1641,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256:
"0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
sha256:
ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
url: "https://pub.dev"
source: hosted
version: "1
4.3.1
"
version: "1
5.0.0
"
web:
dependency: transitive
description:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment