I created a simple shopping cart app using mvvm architecture.
Here is the repo of the code
https://github.com/kprathap23/FlutterApps/tree/main/fakestore_app
Screenshots of the app
Its all about , Latest Android App Development for Phones/Tablets, showing Step by step development Tutorials for beginners, Professionals android developers,Best Practices, Latest android code patterns, UI design Patterns
I created a simple shopping cart app using mvvm architecture.
Here is the repo of the code
https://github.com/kprathap23/FlutterApps/tree/main/fakestore_app
Screenshots of the app
I created a sample application using newsapi.org
Here is the github repo to check the code
https://github.com/kprathap23/FlutterApps/tree/main/news_api
import 'dart:convert'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:news_api/screens/NewsDetailScreen.dart'; class NewsListScreen extends StatefulWidget { @override _NewsListScreenState createState() => _NewsListScreenState(); } class _NewsListScreenState extends State<NewsListScreen> { List<dynamic> _articles = []; @override void initState() { super.initState(); fetchNews(); } Future<void> fetchNews() async { const String apiUrl = 'https://newsapi.org/v2/top-headlines?country=in&apiKey=60e9bee377fe41c5bfb2b6909fe004c8'; final response = await http.get(Uri.parse(apiUrl)); if (response.statusCode == 200) { setState(() { _articles = json.decode(response.body)['articles']; }); } else { throw Exception('Failed to load news'); } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('News App'), ), body: _articles.isEmpty ? const Center(child: CircularProgressIndicator()) : ListView.builder( itemCount: _articles.length, itemBuilder: (context, index) { return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => NewsDetailScreen( url: _articles[index]['url'] ?? "", ), )); }, child: newsCard(index)); }, ), ); } Widget newsCard(int index) { return Padding( padding: const EdgeInsets.fromLTRB(10, 2, 10, 2), child: Card( clipBehavior: Clip.antiAlias, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( width: double.infinity, height: 200, child: CachedNetworkImage( imageUrl: _articles[index]['urlToImage'] ?? "", imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( image: DecorationImage( image: imageProvider, fit: BoxFit.cover, // colorFilter:ColorFilter.mode(Colors.red, BlendMode.colorBurn) ), ), ), placeholder: (context, url) => Center(child: CircularProgressIndicator()), errorWidget: (context, url, error) => Center(child: Icon(Icons.error)), ), ), Padding( padding: const EdgeInsets.fromLTRB(5, 10, 10, 10), child: Text( _articles[index]['title'] ?? "", style: TextStyle( fontSize: 15, fontWeight: FontWeight.w700, color: Colors.black.withOpacity(0.9)), ), ), Padding( padding: const EdgeInsets.fromLTRB(5, 5, 5, 10), child: Text( _articles[index]['author'] ?? "", style: TextStyle(fontSize: 12, color: Colors.black87), ), ), ], ), ), ); } }
Day-3
Day 3
//import liraries
//import liraries
Screenshot
import React from 'react';
Simple Login Screen using SwiftUI
===========================
//
// LoginScreen.swift
// iOSApp1
//
// Created by Pratap Kumar on 04/05/23.
//
import SwiftUI
struct LoginScreen: View {
@State var username : String = "";
@State var email : String = "";
@State var password :String = "";
var colorBlue: Color = Color.blue
var grayBackground: Color = Color.gray.opacity(0.1)
@State private var showingAlert = false
var body: some View {
VStack{
// Welcome Label
Text("Welcome, User")
.foregroundColor(colorBlue)
.padding(.bottom, 30).font(.largeTitle)
// Email Address Field
HStack{
Image(systemName:"envelope.fill").foregroundColor(Color.blue)
TextField("Email Address", text: $email)
}.padding().background(grayBackground).cornerRadius(5.0).padding(.bottom,10)
// Password Field
HStack{
Image(systemName:"lock.fill").foregroundColor(Color.blue)
SecureField("Password", text: $password)
}.padding().background(grayBackground).cornerRadius(5.0).padding(.bottom,10)
Button(action: {
showingAlert = true
}){
Text("Login")
.font(.headline)
.foregroundColor(.white)
.padding()
.frame(width: 150, height: 50)
.background(colorBlue)
.cornerRadius(10.0)
} .alert(isPresented: $showingAlert) {
Alert(title: Text("Login Details"),
message: Text("Email : \(email)\nPassword : \(password)"),
primaryButton: .destructive(Text("OK")),
secondaryButton: .cancel(Text("Cancel")))
}
}.padding(.horizontal)
}
}
struct LoginScreen_Previews: PreviewProvider {
static var previews: some View {
LoginScreen()
}
}
Screenshot
============