As far i know, you not possible to make native widget application and web UI application in same package.
You have to develop two separate apps. One is native widget and another is web UI. But you can acquaint each other apps by their app id.
For example,
In Web App,
var widgetAppName = "XXXXXXXXX.weatherwidget";
if (reqAppControl && reqAppControl.callerAppId && reqAppControl.callerAppId == widgetAppName) {
console.log("Launched by the widget.");
if (reqAppControl.appControl.data[0].key == "city") {
console.log("city from widget: " + reqAppControl.appControl.data[0].value);
readfile(reqAppControl.appControl.data[0].value); // Show latest data with received city
}
}
In web app i acquainted the native widget by its app id.
From native widget, you have to set the app id of web ui app like this,
app_control_set_app_id(control, "YYYYYYY.WeatherWebApp");
You can find this sample app from this link. Download the Sample app and find the weather app for your purposes from this path
Samples/Accessory/Samples(Web)/Weather/Consumer(Tizen)
Hope my idea will help you.