Skip to main content

Make Recipe App in 5 Minute using AI

Make Recipe App in 5 Minute using AI


Step 1 : Go to chatgpt.com, write prompt "Make an Recipe App in flutter" then chatgpt will give you code in flutter. 

Step 2 : Create flutter project and copy code from chatgpt and paste in

 main.dart 

import 'package:flutter/material.dart';

void main() {
  runApp(RecipeApp());
}

class RecipeApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Recipe App',
      theme: ThemeData(
        primarySwatch: Colors.green,
      ),
      home: RecipeListScreen(),
    );
  }
}

class RecipeListScreen extends StatelessWidget {
  final List<Recipe> recipes = [
    Recipe(
        title: 'Spaghetti Bolognese',
        description: 'A classic Italian pasta dish.',
        imageUrl: 'https://img.taste.com.au/qauY2Lmp/w643-h428-cfill-q90/taste/2016/11/spaghetti-bolognese-106560-1.jpeg',
        ingredients: ['Spaghetti', 'Ground beef', 'Tomato sauce'],
        steps: ['Boil spaghetti', 'Cook beef', 'Mix with sauce']),
    Recipe(
        title: 'Chicken Curry',
        description: 'A spicy and savory dish.',
        imageUrl: 'https://t4.ftcdn.net/jpg/10/10/55/81/360_F_1010558143_EFcq6VlfoAbiOkVCNsLeHw4bVoTduzno.jpg',
        ingredients: ['Chicken', 'Curry powder', 'Coconut milk'],
        steps: ['Cook chicken', 'Add curry powder', 'Mix in coconut milk']),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Recipes'),
      ),
      body: ListView.builder(
        itemCount: recipes.length,
        itemBuilder: (context, index) {
          final recipe = recipes[index];
          return Card(
            child: ListTile(
              leading: Image.network(recipe.imageUrl),
              title: Text(recipe.title),
              subtitle: Text(recipe.description),
              onTap: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => RecipeDetailScreen(recipe: recipe),
                  ),
                );
              },
            ),
          );
        },
      ),
    );
  }
}

class RecipeDetailScreen extends StatelessWidget {
  final Recipe recipe;

  RecipeDetailScreen({required this.recipe});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(recipe.title),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Image.network(recipe.imageUrl,width: 100,),
            SizedBox(height: 16),
            Text('Ingredients:',
                style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            ...recipe.ingredients.map((ingredient) => Text('- $ingredient')),
            SizedBox(height: 16),
            Text('Steps:',
                style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
            ...recipe.steps.map((step) => Text('- $step')),
          ],
        ),
      ),
    );
  }
}

class Recipe {
  final String title;
  final String description;
  final String imageUrl;
  final List<String> ingredients;
  final List<String> steps;

  Recipe({
    required this.title,
    required this.description,
    required this.imageUrl,
    required this.ingredients,
    required this.steps,
  });
}

Step 3 - Run code then you will get output 


Comments

Popular posts from this blog

Referral & Deep linking

  Plugins :  app_links: android_play_install_referrer: Link to share :  https://play.google.com/store/apps/details?id=com.erer&referrer=referral_code%3DTEST123 Flutter Code :  import 'package:app_links/app_links.dart' ; import 'package:android_play_install_referrer/android_play_install_referrer.dart' ; import 'package:flutter/foundation.dart' ; import 'package:shared_preferences/shared_preferences.dart' ; class DeepLinkService {   static const String _referralKey = 'referral_code' ;   static final AppLinks _appLinks = AppLinks ();   static Future < void > initDeepLinks () async {     debugPrint ( 'Initializing deep links...' );     // 1️⃣ Handle real-time deep/link stream     try {       final Uri ? initialUri = await _appLinks . getInitialAppLink ();       if ( initialUri != null ) {         debugPrint ( 'Initial deep link: $initialUri'...

API security best practices

 API with a focus on security best practices : Key Security Practices Included: Input Validation and Sanitization : All inputs are validated and sanitized to prevent SQL injection and other attacks. Prepared Statements : All database queries use prepared statements to avoid SQL injection. Password Hashing : Passwords are hashed using password_hash() and verified using password_verify() . Token-Based Authentication : JSON Web Tokens (JWTs) are used for secure API authentication. Error Hiding : Error details are logged but not exposed to users in production. Strict Content-Type Header : Ensures only JSON payloads are processed. Rate Limiting and Throttling : Optional mechanisms to prevent abuse. Validation for IDs : Integer inputs (like user_id or exam_id ) are explicitly validated.

Native api call flutter in terminated state

Calling Native Android Code from Flutter (Step-by-Step for Beginners) When you need to run platform-specific features (like background services, Bluetooth, or sensors) that Flutter doesn’t handle out of the box, you can use MethodChannels to talk to native Android or iOS code. In this tutorial, we’ll: Create a MethodChannel in Flutter. Set up a foreground service in Android. Trigger that service from Flutter—even when the app is closed. 1. What Is a MethodChannel? Think of a MethodChannel as a telephone line between Flutter (Dart) and the platform’s native code (Java/Kotlin for Android, Swift/Objective-C for iOS). Flutter side: “📞 Hey Android, please start the service!” Android side: “✅ Got it, I’m starting it now.” 2. Create the Channel in Flutter Create a new file: lib/native_service.dart import 'package:flutter/services.dart' ; class NativeService {   // ✅ A generic channel name you can reuse in any project   static const _channel = MethodChanne...