Skip to content

Instantly share code, notes, and snippets.

View azamsharp's full-sized avatar

Mohammad Azam azamsharp

View GitHub Profile
class Rating extends StatefulWidget {
final int maximumRating;
Rating([this.maximumRating = 5]);
@override
_Rating createState() => _Rating();
}
@azamsharp
azamsharp / .swift
Created October 8, 2020 13:08
Mobile Banking App
//
// ContentView.swift
// MobileBankApp
//
// Created by Mohammad Azam on 10/7/20.
//
import SwiftUI
struct Card: View {
<html>
<head>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>TODO List</h1>
<input type="text" id="taskNameTextBox" />
<button id="saveButton">Save Task</button>
//
// ContentView.swift
// PlantsApp
//
// Created by Mohammad Azam on 9/28/20.
//
import SwiftUI
struct ContentView: View {
// Classes in JavaScript
function Car(make, model) {
this.make = make
this.model = model
}
/*
function drive() {
console.log("Car is driving")
/* By default Flexbox have flex-direction: row */
/* When FlexBox is row then justify content moves items left/right
When FlexBox is column then justify content moves items up/down
When FlexBox is row align-items moves up/down
When FlexBox is column align-items movies left-right
*/
from datetime import datetime
class PoolTable:
def __init__(self, table_number):
self.table_number = table_number
self.start_time = None
self.end_time = None
self.time_played = None
def check_out(self):
// Store.swift
typealias ActionCreator = (_ dispatch: @escaping (Action) -> ()) -> ()
func getMovies() -> ActionCreator {
return { dispatch in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
dispatch(.populateMovies([Movie(title: "ABC")]))
}
struct ContentView: View {
@State private var rating: Int?
var body: some View {
VStack {
RatingView(rating: $rating, max: 5)
Text(rating != nil ? "You rating: \(rating!)" : "")
}
}
var body: some View {
HStack {
ForEach(1..<(max + 1), id: \.self) { index in
Image(systemName: self.starType(index: index))
.foregroundColor(Color.orange)
.onTapGesture {
self.rating = index
}
}
}