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
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: "FlutterApp", | |
home: Text("Hello World!"), |
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
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: "FlutterApp", | |
home: Scaffold( |
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
class MyCard extends StatelessWidget{ | |
const MyCard({Key key, this.h, this.w}) : super(key:key); | |
final double h,w; | |
@override | |
Widget build(BuildContext context){ | |
return Card( | |
child: Container( | |
width: w, | |
height: h |
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
class MyWidget extends StatefulWidget{ | |
_MyWidgetState createState() => _MyWidgetState(); | |
} | |
class _MyWidgetState extends State<MyWidget>{ | |
int num = 0; | |
@override | |
Widget build(BuildContext context){ | |
return Row( | |
children: <Widget>[ |
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
class _MyHomePageState extends State<MyHomePage> { | |
static const platform = const MethodChannel('ourproject.sendstring'); | |
String receivedString = ""; | |
Future<void> callNativeFunction() async { | |
String msg = "Hello from Flutter",data=""; | |
try { | |
final String temp = await platform.invokeMethod('callSendStringFun',{"arg":msg}); | |
data = temp; | |
} on PlatformException catch (e) { |
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
package com.example.ourproject | |
import android.os.Bundle | |
import io.flutter.plugin.common.MethodChannel | |
import android.widget.Toast | |
import io.flutter.app.FlutterActivity | |
import io.flutter.plugins.GeneratedPluginRegistrant | |
class MainActivity: FlutterActivity() { | |
private val CHANNEL = "ourproject.sendstring" |
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
package com.example.ourproject; | |
import android.os.Bundle; | |
import io.flutter.app.FlutterActivity; | |
import io.flutter.plugins.GeneratedPluginRegistrant; | |
import android.widget.Toast; | |
import io.flutter.plugin.common.MethodCall; | |
import io.flutter.plugin.common.MethodChannel; | |
import io.flutter.plugin.common.MethodChannel.MethodCallHandler; | |
import io.flutter.plugin.common.MethodChannel.Result; |
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
//Put this code in the class which extens State class | |
static const platform = const MethodChannel('samples.flutter.dev/filesChannel'); //used to connect with Java/Kotlin | |
List<dynamic> fileNames = <dynamic>[]; | |
Future<void> _invokeNativeFun(int flag) async { | |
String s; | |
try { | |
if(flag == 0) | |
fileNames = await platform.invokeMethod('getNames'); //getNames function called from Kotlin/Java |
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
//A code for article published at calloftechies.com | |
private fun getNames() : ArrayList<String?>{ | |
var files = myDirectory.listFiles() | |
val fileNames : ArrayList<String?> = ArrayList() | |
for(file in files){ | |
fileNames.add(file.getName()) | |
} | |
return fileNames | |
} |
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
#How to get contingency table | |
import pandas as pd | |
#Read the csv data file | |
data = pd.read_csv('train.csv') | |
#Getting 'Embarked' feature values without null value | |
embarked = data[pd.notnull(data['Embarked'])]['Embarked'] | |
#Getting 'Survival' feature values correponding to 'Embarked' |
OlderNewer