Skip to content

Instantly share code, notes, and snippets.

View rajajawahar's full-sized avatar
🏠
Working from home

Raja Jawahar rajajawahar

🏠
Working from home
View GitHub Profile
class Employee{
String firstName;
String lastName;
String mobileNo;
String emailId;
Employee(this.firstName, this.lastName,this.mobileNo,this.emailId);
}
class _MyHomePageState extends State<MyHomePage> {
String firstname;
String lastname;
String emailId;
String mobileno;
final scaffoldKey = new GlobalKey<ScaffoldState>();
final formKey = new GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
void _submit() {
if (this.formKey.currentState.validate()) {
formKey.currentState.save();
}
var employee = Employee(firstname,lastname,mobileno,emailId);
var dbHelper = DBHelper();
dbHelper.saveEmployee(employee);
_showSnackBar("Data saved successfully");
}
import 'package:flutter/material.dart';
import 'package:sqflitedatabase/model/employee.dart';
import 'dart:async';
import 'package:sqflitedatabase/database/dbhelper.dart';
Future<List<Employee>> fetchEmployeesFromDatabase() async {
var dbHelper = DBHelper();
Future<List<Employee>> employees = dbHelper.getEmployees();
return employees;
}
import UIKit
protocol BasePresenter {
// Protocol does not support generics, so we have added associated type,
// Anything that conforms to BasePresenter
associatedtype View
func attachView(view : View)
protocol BaseView {
func showError(message : String)
}
package com.sample.tryanko
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.alert_dialogue
import kotlinx.android.synthetic.main.activity_main.button
import kotlinx.android.synthetic.main.activity_main.coordinatorLayout
import kotlinx.android.synthetic.main.activity_main.dialogue
import kotlinx.android.synthetic.main.activity_main.longToast
import kotlinx.android.synthetic.main.activity_main.longsnackbar
class LoginActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
LoginActivityUI().setContentView(this)
}
}
class LoginActivityUI : AnkoComponent<LoginActivity> {
class MainActivity : AppCompatActivity() {
private var toolBar: Toolbar? = null
private var container: ViewGroup? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
coordinatorLayout {
fitsSystemWindows = true
appBarLayout {
protocol LoginView {
func navigateToHome()
func showLoading()
func hideLoading();
func showMessage(message: String)