How to jump from flutter_web page to the outside web link? - flutter-web

I am trying to use flutter to develop a web site. Now I need to jump from my web page to a link outside the station. How should I do it?

First you need to import import 'dart:js' as js; and then you can open a link like the following example:
. . .
onPressed: () {
js.context.callMethod("open", ["https://google.com"]);
},
. . .

Related

How can I make a main URL with sub URL for different Django app?

I want to make a main URL and that URL will be the main route for all my Django apps.
Suppose I have 3 apps: blog, linux and business. I want to make URLs like this:
127.0.0.1:8000/blog/ (when i will click blog menu)
127.0.0.1:8000/blog/linux ( when i will click linux menu)
127.0.0.1:8000/blog/business (when i will click business menu)
The blog app will be my index home page and all the apps' links will be like this. I don't want to import all of the views and models in the blog app. The project's structure will be the same and I don't want to change it.
All I want is to make blog common for all the apps. If I click a post on a linux page, the URL will be like this:
127.0.0.1:8000/blog/linux/post name
How can I do this?
This is my project's structure:
[]
You can write all the URLs into the urls.py in your project folder or you can make a urls.py in your apps folder. Maybe read this
After Creating the App in django project by following procedure in https://docs.djangoproject.com/en/3.0/intro/tutorial01/
App Folder (blog app folder, found inside project folder)
Add these urls
127.0.0.1:8000/blog/linux
127.0.0.1:8000/blog/business
to the app/urls.py file above the admin.site url path
Project Folder:
Configure the urls.py file in the project folder by adding the 127.0.0.1:8000/blog/ url above the admin.site url path. This configuration is done to load this url when the server starts running.
The django checks for the requested url pattern and will route the first discovered url.
The django cannot identify duplicate url.

How to use existing scanning software dll file using Node js for create Scanning functionality in Node js and Angular 8?

I have a requirement to create scanning functionality using Node js API with existing scanning software in PC. so How can I achieve that type of functionality using Node js and Angular-8.
I have already checked Dynam Twain SDK but it is available only for 30 day trail.
Thanks to all for your help.
Your question is a little confusing. Indeed, Dynamic Web Twain can simply run a web server with node.js to load web applications. But since you already mentioned Angular-8, you may want to use Node.js API to call Dynamic Web Twain to scan pages, right?
Here is a sample shows how to integrate Dynamic Web TWAIN JavaScript library into an Angular project.
export class AppComponent implements OnInit {
title = 'angular-cli-application';
DWObject: WebTwain;
selectSources: HTMLSelectElement;
ngOnInit() {
Dynamsoft.WebTwainEnv.AutoLoad = false;
Dynamsoft.WebTwainEnv.Containers = [{ ContainerId: 'dwtcontrolContainer', Width: '583px', Height: '513px' }];
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', () => { this.Dynamsoft_OnReady(); });
Dynamsoft.WebTwainEnv.Trial = true;
Dynamsoft.WebTwainEnv.ProductKey = "A-Valid-Product-Key";
//Dynamsoft.WebTwainEnv.ResourcesPath = "https://tst.dynamsoft.com/libs/dwt/15.2";
Dynamsoft.WebTwainEnv.Load();
}
You can find the code here.
And if you want to scan documents with Node.js API on the server-side, you can refer to the code here.

How do I add the explorer to GraphiQL using 'flask-graphql'?

I am serving GraphiQL using flask-graphql but do not see any way to enable GraphiQL's "explorer" without using Node.JS. Is there a way to enable the explorer for a Python (flask-graphql) backend?
Node.js is not required, but React is since both graphiql and graphiql-explorer are React components. flask-graphql just renders an HTML page with a script that renders the GraphiQL interface using React as shown here.
You should be able to provide your own template for rendering this page when creating your GraphQLView via the graphiql_template option as shown here.
Copy and paste the existing template, then add the script tag for the library:
<script src="//cdn.jsdelivr.net/npm/graphiql-explorer#0.4.6/graphiqlExplorer.min.js"></script>
And implement the component as shown here. Since you're not transpiling this code, you won't be able to use JSX, so you'll need to do something like...
React.createElement(
"div",
{ className: "graphiql-container" },
React.createElement(
GraphiQLExplorer,
{ /* props here */ },
),
React.createElement(
GraphiQL,
{ /* props here */ },
)
)
Someone asked on the flask-graphql repo how to do it and I provided the initial template setup to get the explorer with some minor styles over that: Enabling "explorer" at Flask-graphql.

How to access the "foo" controller in the jhipster-sample-app?

I'm starting to learn AngularJS and as Java/Maven/Spring developer, the jhipster yeoman generator looks great.
I've cloned the jhipster-sample-app, imported it into my IDE and started it via Maven command mvn spring-boot:run. (I know that when I want to generate my own app, i can use yo jhipster)
I am able to browse the app at http://localhost:8080/ and also login as 'user' and 'admin'
How do I navigate to the Foo entity in the sample app?
I've tried http://localhost:8080/#/foo which redirects back to the homepage.
On the server side, I see the sample app has a Foo entity, repository, and resource. On the AngularJS side, I also there is a Foo controller, router, service, and view.
What am i missing?
The sample is just an example of the "default" application, the "foo" entity is not complete.
If you use the generator, here are the steps to make the "foo" entity working:
http://jhipster.github.io/creating_an_entity.html
There are basically the same steps to do on the sample application: you need to set up the database tables (in Liquibase, they are just commented), and import the JS files in your main app.
But you are right, we should generate a complete entity in the sample application (or no entity at all!), but not provide this half complete result.

Drag 'n' Drop files to a Chrome Package App?

Has anyone successfully implemented drag and drop with files from desktop to the app?
I've tried just putting this drag 'n' drop example into the index file but I just get this error:
Can't open same-window link to "file:///C:/Users....whatever"; try target="_blank".
Please share your stories, what you've tried and if you have succeed :)
Some resources to help you:
New Chrome Packaged Apps codelab that we've been working on covers drag-and-drop in both AngularJS and pure JavaScript.
AngularJS drag-and-drop: https://github.com/GoogleChrome/chrome-app-codelab/tree/master/lab5_data/angularjs/2_drop_files
JavaScript drag-and-drop: https://github.com/GoogleChrome/chrome-app-codelab/tree/master/lab5_data/javascript/2_drop_files
There's an early version of docs too for AngularJS drag-and-drop for Chrome at developer.chrome.com/trunk/apps/app_codelab5_data.html#handle_drag_and_dropped_files_and_urls
We're working on the docs to cover both samples though.
I have done this a while ago and it worked.
The problem you've got is that you are creating a file url, then trying to navigate to the url. The navigation is failing, not the read. It's failing due to CSP, and you probably won't be able to override that with a different CSP due to security restrictions we've placed on allowable CSPs.
But, you should be able to just read the file and use the content. You need to change that sample code to use ReadAsText or ReadAsArrayBuffer instead of readAsDataURL. Look here for more details.
Please let us know how you get on!
Just listening for drop won't work. You will have to prevent the default functionality of dragover.
document.body.addEventListener('dragover', function(e) {
e.preventDefault();
}
document.body.addEventListener('drop', function(e) {
alert('it works!')
}

Resources