-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09f23b1
commit ac15082
Showing
16 changed files
with
1,006 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ | |
.history | ||
.svn/ | ||
|
||
# Visual Studio Code related | ||
.vscode/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>android</name> | ||
<comment>Project android created by Buildship.</comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
arguments= | ||
auto.sync=false | ||
build.scans.enabled=false | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||
connection.project.dir= | ||
eclipse.preferences.version=1 | ||
gradle.user.home= | ||
java.home=/opt/jdk-11.0.2 | ||
jvm.arguments= | ||
offline.mode=false | ||
override.workspace.settings=true | ||
show.console.view=true | ||
show.executions.view=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> | ||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
<classpathentry kind="output" path="bin/default"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>app</name> | ||
<comment>Project app created by Buildship.</comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
connection.project.dir=.. | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:qr_code_scanner/qr_code_scanner.dart'; | ||
import 'package:selftrackingapp/page/screen/qr_webview_screen.dart'; | ||
import 'package:webview_flutter/webview_flutter.dart'; | ||
|
||
class QrScanScreen extends StatefulWidget { | ||
@override | ||
_QrScanScreenState createState() => _QrScanScreenState(); | ||
} | ||
|
||
class _QrScanScreenState extends State<QrScanScreen> { | ||
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); | ||
var qrText = ""; | ||
QRViewController controller; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
controller?.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Column( | ||
children: <Widget>[ | ||
Expanded( | ||
flex: 5, | ||
child: QRView( | ||
key: qrKey, | ||
onQRViewCreated: _onQRViewCreated, | ||
), | ||
), | ||
Expanded( | ||
flex: 1, | ||
child: Center( | ||
child: IconButton( | ||
icon: Icon(Icons.query_builder), | ||
onPressed: () { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => QrWebviewScreen( | ||
url: 'https://staysafe.gov.lk/', | ||
))); | ||
}, | ||
)), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
|
||
void _handleURLButtonPress(BuildContext context, String url) { | ||
Navigator.push(context, | ||
MaterialPageRoute(builder: (context) => QrWebviewScreen(url: url))); | ||
} | ||
|
||
void _onQRViewCreated(QRViewController controller) { | ||
this.controller = controller; | ||
controller.scannedDataStream.listen((scanData) { | ||
setState(() { | ||
qrText = scanData; | ||
_handleURLButtonPress(context, qrText); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:qr_code_scanner/qr_code_scanner.dart'; | ||
import 'package:webview_flutter/webview_flutter.dart'; | ||
|
||
class QrWebviewScreen extends StatefulWidget { | ||
final String url; | ||
|
||
const QrWebviewScreen({Key key, this.url}) : super(key: key); | ||
@override | ||
_QrWebviewScreenState createState() => _QrWebviewScreenState(); | ||
} | ||
|
||
WebViewController controllerGlobal; | ||
|
||
class _QrWebviewScreenState extends State<QrWebviewScreen> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return WillPopScope( | ||
onWillPop: () => _exitApp(context), | ||
child: Scaffold( | ||
body: WebView( | ||
initialUrl: widget.url, | ||
), | ||
), | ||
); | ||
} | ||
|
||
Future<bool> _exitApp(BuildContext context) async { | ||
print("cal"); | ||
if (await controllerGlobal.canGoBack()) { | ||
print("onwill goback"); | ||
controllerGlobal.goBack(); | ||
} else { | ||
Scaffold.of(context).showSnackBar( | ||
const SnackBar(content: Text("No back history item")), | ||
); | ||
return Future.value(false); | ||
} | ||
} | ||
} |
Oops, something went wrong.