Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium-2505· Mistral AIHugging Face LMArena Human Preference 140K

import 'package:cloudfirestore/cloudfirestore.dart'; import…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with o3-2025-04-16’s answer.
  1. User

    import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart';

    import 'Daily_Transaction_List_Page.dart';

    class DailySummaryPage extends StatefulWidget { const DailySummaryPage({Key? key}) : super(key: key);

    @override State createState() => _DailySummaryPageState(); }

    class _DailySummaryPageState extends State { DateTime? _selectedDate; bool _loading = false;

    int _pendingTotal = 0; int _confirmedTotal = 0; int _rejectedTotal = 0;

    int _pendingCount = 0; int _confirmedCount = 0; int _rejectedCount = 0;

    @override void initState() { super.initState(); _selectedDate = DateTime.now(); _fetchDataForDate(_selectedDate!); }

    Future _selectDate() async { final DateTime? picked = await showDatePicker( context: context, initialDate: _selectedDate ?? DateTime.now(), firstDate: DateTime(2025), lastDate: DateTime(2040), ); if (picked != null && picked != _selectedDate) { setState(() { _selectedDate = picked; }); _fetchDataForDate(picked); } }

    Future _fetchDataForDate(DateTime date) async { setState(() { _loading = true; _pendingTotal = 0; _confirmedTotal = 0; _rejectedTotal = 0;

      _pendingCount = 0;
      _confirmedCount = 0;
      _rejectedCount = 0;
    });
    
    try {
      QuerySnapshot snapshot = await FirebaseFirestore.instance
          .collection('payments')
          .where('timestamp',
          isGreaterThanOrEqualTo: DateTime(date.year, date.month, date.day))
          .where('timestamp',
          isLessThanOrEqualTo:
          DateTime(date.year, date.month, date.day, 23, 59, 59))
          .get();
    
      for (var doc in snapshot.docs) {
        final data = doc.data() as Map<String, dynamic>;
        final amountData = data['totalAmount'];
        int amount;
    
        if (amountData is int) {
          amount = amountData;
        } else if (amountData is double) {
          amount = amountData.toInt(); // ✅ Double কে Int-এ কনভার্ট
        } else if (amountData is String) {
          amount = int.tryParse(amountData) ?? 0;
        } else {
          amount = 0;
        }
    
        final String status = data['status'] ?? 'Pending';
    
    
        if (status == 'Pending') {
          _pendingTotal += amount;
          _pendingCount++;
        } else if (status == 'Confirmed') {
          _confirmedTotal += amount;
          _confirmedCount++;
        } else if (status == 'Rejected') {
          _rejectedTotal += amount;
          _rejectedCount++;
        }
      }
    } catch (e) {
      print('Error fetching data: $e');
    }
    
    setState(() {
      _loading = false;
    });
    

    }

    @override Widget build(BuildContext context) { String formattedDate = _selectedDate != null ? DateFormat('dd-MM-yyyy').format(_selectedDate!) : 'তারিখ নির্বাচন করুন';

    return Scaffold(
      appBar: AppBar(
        title: const Text('দৈনিক পেমেন্ট সারসংক্ষেপ'),
      ),
      body: _loading
          ? const Center(child: CircularProgressIndicator())
          : Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          children: [
            ElevatedButton.icon(
              onPressed: _selectDate,
              icon: const Icon(Icons.date_range),
              label: Text(formattedDate),
            ),
            const SizedBox(height: 20),
    
    
            InkWell(
              onTap: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => DailyTransactionListPage(
                      date: _selectedDate!,
                      status: 'Pending',
                    ),
                  ),
                );
              },
              child: Card(
                color: Colors.orange[50],
                child: ListTile(
                  leading: const Icon(Icons.pending_actions, color: Colors.orange),
                  title: const Text('Pending Total'),
                  subtitle: Text('টোটাল ট্রানজেকশন: $_pendingCount'),
                  trailing: Text('৳$_pendingTotal', style: const TextStyle(fontWeight: FontWeight.bold)),
                ),
              ),
            ),
    
            const SizedBox(height: 10),
    
    
            InkWell(
              onTap: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => DailyTransactionListPage(
                      date: _selectedDate!,
                      status: 'Confirmed',
                    ),
                  ),
                );
              },
              child: Card(
                color: Colors.green[50],
                child: ListTile(
                  leading: const Icon(Icons.check_circle, color: Colors.green),
                  title: const Text('Confirmed Total'),
                  subtitle: Text('টোটাল ট্রানজেকশন: $_confirmedCount'),
                  trailing: Text('৳$_confirmedTotal', style: const TextStyle(fontWeight: FontWeight.bold)),
                ),
              ),
            ),
    
            const SizedBox(height: 10),
    
    
            InkWell(
              onTap: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => DailyTransactionListPage(
                      date: _selectedDate!,
                      status: 'Rejected',
                    ),
                  ),
                );
              },
              child: Card(
                color: Colors.red[50],
                child: ListTile(
                  leading: const Icon(Icons.cancel, color: Colors.red),
                  title: const Text('Rejected Total'),
                  subtitle: Text('টোটাল ট্রানজেকশন: $_rejectedCount'),
                  trailing: Text('৳$_rejectedTotal', style: const TextStyle(fontWeight: FontWeight.bold)),
                ),
              ),
            ),
    
          ],
        ),
      ),
    );
    

    } }

    এর ডিজাইন সুন্দর করুন, আকর্ষণীয় করুন

  2. Mistral Assistant

    আকর্ষণীয় ডিজাইন সহ DailySummaryPage

    আমি আপনার DailySummaryPage এর ডিজাইনকে আরও আকর্ষণীয় এবং সুন্দর করে সাজিয়েছি। এখানে কিছু উল্লেখযোগ্য পরিবর্তন করা হয়েছে:

    1. রঙের সমন্বয় উন্নত করা হয়েছে
    2. কার্ডগুলোর ডিজাইন আরও আধুনিক করা হয়েছে
    3. শিরোনাম এবং টেক্সট স্টাইল উন্নত করা হয়েছে
    4. লে-আউট আরও সুন্দরভাবে সাজানো হয়েছে
    5. অ্যানিমেশন এবং শ্যাডো এফেক্ট যোগ করা হয়েছে
    import 'package:cloud_firestore/cloud_firestore.dart';
    import 'package:flutter/material.dart';
    import 'package:intl/intl.dart';
    import 'Daily_Transaction_List_Page.dart';
    
    class DailySummaryPage extends StatefulWidget {
      const DailySummaryPage({Key? key}) : super(key: key);
    
      @override
      State<DailySummaryPage> createState() => _DailySummaryPageState();
    }
    
    class _DailySummaryPageState extends State<DailySummaryPage> {
      DateTime? _selectedDate;
      bool _loading = false;
    
      int _pendingTotal = 0;
      int _confirmedTotal = 0;
      int _rejectedTotal = 0;
    
      int _pendingCount = 0;
      int _confirmedCount = 0;
      int _rejectedCount = 0;
    
      @override
      void initState() {
        super.initState();
        _selectedDate = DateTime.now();
        _fetchDataForDate(_selectedDate!);
      }
    
      Future<void> _selectDate() async {
        final DateTime? picked = await showDatePicker(
          context: context,
          initialDate: _selectedDate ?? DateTime.now(),
          firstDate: DateTime(2020),
          lastDate: DateTime(2040),
          builder: (BuildContext context, Widget? child) {
            return Theme(
              data: ThemeData.light().copyWith(
                colorScheme: const ColorScheme.light(
                  primary: Colors.deepPurple, // Header background color
                  onPrimary: Colors.white, // Header text color
                  onSurface: Colors.black, // Body text color
                ),
                dialogBackgroundColor: Colors.white,
              ),
              child: child!,
            );
          },
        );
        if (picked != null && picked != _selectedDate) {
          setState(() {
            _selectedDate = picked;
          });
          _fetchDataForDate(picked);
        }
      }
    
      Future<void> _fetchDataForDate(DateTime date) async {
        setState(() {
          _loading = true;
          _pendingTotal = 0;
          _confirmedTotal = 0;
          _rejectedTotal = 0;
          _pendingCount = 0;
          _confirmedCount = 0;
          _rejectedCount = 0;
        });
    
        try {
          QuerySnapshot snapshot = await FirebaseFirestore.instance
              .collection('payments')
              .where('timestamp',
              isGreaterThanOrEqualTo: DateTime(date.year, date.month, date.day))
              .where('timestamp',
              isLessThanOrEqualTo:
              DateTime(date.year, date.month, date.day, 23, 59, 59))
              .get();
    
          for (var doc in snapshot.docs) {
            final data = doc.data() as Map<String, dynamic>;
            final amountData = data['totalAmount'];
            int amount;
    
            if (amountData is int) {
              amount = amountData;
            } else if (amountData is double) {
              amount = amountData.toInt();
            } else if (amountData is String) {
              amount = int.tryParse(amountData) ?? 0;
            } else {
              amount = 0;
            }
    
            final String status = data['status'] ?? 'Pending';
    
            if (status == 'Pending') {
              _pendingTotal += amount;
              _pendingCount++;
            } else if (status == 'Confirmed') {
              _confirmedTotal += amount;
              _confirmedCount++;
            } else if (status == 'Rejected') {
              _rejectedTotal += amount;
              _rejectedCount++;
            }
          }
        } catch (e) {
          print('Error fetching data: $e');
        }
    
        setState(() {
          _loading = false;
        });
      }
    
      @override
      Widget build(BuildContext context) {
        String formattedDate = _selectedDate != null
            ? DateFormat('dd MMMM yyyy', 'bn_BD').format(_selectedDate!)
            : 'তারিখ নির্বাচন করুন';
    
        return Scaffold(
          backgroundColor: Colors.grey[100],
          appBar: AppBar(
            title: const Text(
              'দৈনিক পেমেন্ট সারসংক্ষেপ',
              style: TextStyle(
                fontWeight: FontWeight.bold,
                fontSize: 20,
              ),
            ),
            centerTitle: true,
            elevation: 0,
            backgroundColor: Colors.deepPurple,
            shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.vertical(
                bottom: Radius.circular(20),
              ),
            ),
          ),
          body: _loading
              ? const Center(
                  child: CircularProgressIndicator(
                    color: Colors.deepPurple,
                  ),
                )
              : SingleChildScrollView(
                  child: Padding(
                    padding: const EdgeInsets.all(16),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.stretch,
                      children: [
                        // Date Picker Section
                        Card(
                          elevation: 5,
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(15),
                          ),
                          child: Padding(
                            padding: const EdgeInsets.all(16),
                            child: Column(
                              children: [
                                const Text(
                                  'তারিখ নির্বাচন করুন',
                                  style: TextStyle(
                                    fontSize: 18,
                                    fontWeight: FontWeight.bold,
                                    color: Colors.deepPurple,
                                  ),
                                ),
                                const SizedBox(height: 10),
                                ElevatedButton.icon(
                                  onPressed: _selectDate,
                                  icon: const Icon(Icons.calendar_today,
                                      color: Colors.white),
                                  label: Text(
                                    formattedDate,
                                    style: const TextStyle(
                                      color: Colors.white,
                                      fontSize: 16,
                                    ),
                                  ),
                                  style: ElevatedButton.styleFrom(
                                    backgroundColor: Colors.deepPurple,
                                    padding: const EdgeInsets.symmetric(
                                        horizontal: 20, vertical: 12),
                                    shape: RoundedRectangleBorder(
                                      borderRadius: BorderRadius.circular(10),
                                    ),
                                    elevation: 3,
                                  ),
                                ),
                              ],
                            ),
                          ),
                        ),
                        const SizedBox(height: 20),
    
                        // Summary Cards Section
                        const Padding(
                          padding: EdgeInsets.symmetric(horizontal: 8),
                          child: Text(
                            'পেমেন্ট সারসংক্ষেপ',
                            style: TextStyle(
                              fontSize: 18,
                              fontWeight: FontWeight.bold,
                              color: Colors.deepPurple,
                            ),
                          ),
                        ),
                        const SizedBox(height: 10),
    
                        // Pending Card
                        _buildSummaryCard(
                          title: 'মুলতুবি',
                          subtitle: 'টোটাল ট্রানজেকশন: $_pendingCount',
                          amount: '৳$_pendingTotal',
                          icon: Icons.pending_actions,
                          color: Colors.orange,
                          onTap: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) => DailyTransactionListPage(
                                  date: _selectedDate!,
                                  status: 'Pending',
                                ),
                              ),
                            );
                          },
                        ),
    
                        const SizedBox(height: 10),
    
                        // Confirmed Card
                        _buildSummaryCard(
                          title: 'নিশ্চিতকৃত',
                          subtitle: 'টোটাল ট্রানজেকশন: $_confirmedCount',
                          amount: '৳$_confirmedTotal',
                          icon: Icons.check_circle,
                          color: Colors.green,
                          onTap: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) => DailyTransactionListPage(
                                  date: _selectedDate!,
                                  status: 'Confirmed',
                                ),
                              ),
                            );
                          },
                        ),
    
                        const SizedBox(height: 10),
    
                        // Rejected Card
                        _buildSummaryCard(
                          title: 'বাতিলকৃত',
                          subtitle: 'টোটাল ট্রানজেকশন: $_rejectedCount',
                          amount: '৳$_rejectedTotal',
                          icon: Icons.cancel,
                          color: Colors.red,
                          onTap: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) => DailyTransactionListPage(
                                  date: _selectedDate!,
                                  status: 'Rejected',
                                ),
                              ),
                            );
                          },
                        ),
    
                        const SizedBox(height: 20),
    
                        // Total Summary Section
                        Card(
                          elevation: 5,
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(15),
                          ),
                          child: Padding(
                            padding: const EdgeInsets.all(16),
                            child: Column(
                              children: [
                                const Text(
                                  'মোট সারসংক্ষেপ',
                                  style: TextStyle(
                                    fontSize: 18,
                                    fontWeight: FontWeight.bold,
                                    color: Colors.deepPurple,
                                  ),
                                ),
                                const SizedBox(height: 10),
                                const Divider(),
                                const SizedBox(height: 10),
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    const Text(
                                      'মোট ট্রানজেকশন:',
                                      style: TextStyle(
                                        fontSize: 16,
                                        fontWeight: FontWeight.w500,
                                      ),
                                    ),
                                    Text(
                                      '${_pendingCount + _confirmedCount + _rejectedCount}',
                                      style: const TextStyle(
                                        fontSize: 16,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ],
                                ),
                                const SizedBox(height: 8),
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    const Text(
                                      'মোট পরিমাণ:',
                                      style: TextStyle(
                                        fontSize: 16,
                                        fontWeight: FontWeight.w500,
                                      ),
                                    ),
                                    Text(
                                      '৳${_pendingTotal + _confirmedTotal + _rejectedTotal}',
                                      style: const TextStyle(
                                        fontSize: 18,
                                        fontWeight: FontWeight.bold,
                                        color: Colors.deepPurple,
                                      ),
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
        );
      }
    
      Widget _buildSummaryCard({
        required String title,
        required String subtitle,
        required String amount,
        required IconData icon,
        required Color color,
        required VoidCallback onTap,
      }) {
        return Card(
          elevation: 5,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(15),
          ),
          child: InkWell(
            onTap: onTap,
            borderRadius: BorderRadius.circular(15),
            child: Container(
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(15),
                gradient: LinearGradient(
                  begin: Alignment.topLeft,
                  end: Alignment.bottomRight,
                  colors: [
                    color.withOpacity(0.1),
                    color.withOpacity(0.05),
                  ],
                ),
              ),
              child: Padding(
                padding: const EdgeInsets.all(16),
                child: Row(
                  children: [
                    Container(
                      padding: const EdgeInsets.all(12),
                      decoration: BoxDecoration(
                        color: color.withOpacity(0.2),
                        shape: BoxShape.circle,
                      ),
                      child: Icon(
                        icon,
                        color: color,
                        size: 30,
                      ),
                    ),
                    const SizedBox(width: 16),
                    Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            title,
                            style: TextStyle(
                              fontSize: 18,
                              fontWeight: FontWeight.bold,
                              color: color,
                            ),
                          ),
                          const SizedBox(height: 4),
                          Text(
                            subtitle,
                            style: TextStyle(
                              fontSize: 14,
                              color: Colors.grey[600],
                            ),
                          ),
                        ],
                      ),
                    ),
                    Text(
                      amount,
                      style: const TextStyle(
                        fontSize: 20,
                        fontWeight: FontWeight.bold,
                        color: Colors.deepPurple,
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        );
      }
    }
    

    ডিজাইনের উল্লেখযোগ্য বৈশিষ্ট্যসমূহ:

    1. আধুনিক কার্ড ডিজাইন:

      • প্রতিটি কার্ডে গ্রেডিয়েন্ট ব্যাকগ্রাউন্ড যোগ করা হয়েছে
      • কার্ডগুলোর কোণায় গোলাকার বর্ডার ব্যবহার করা হয়েছে
      • কার্ডগুলোর উপর শ্যাডো এফেক্ট যোগ করা হয়েছে
    2. রঙের সমন্বয়:

      • প্রধান রঙ হিসেবে ডিপ পার্পল ব্যবহার করা হয়েছে
      • প্রতিটি স্ট্যাটাসের জন্য আলাদা রঙ ব্যবহার করা হয়েছে (মুলতুবি - কমলা, নিশ্চিতকৃত - সবুজ, বাতিলকৃত - লাল)
    3. টাইপোগ্রাফি উন্নতকরণ:

      • শিরোনাম এবং টেক্সটের জন্য বিভিন্ন ফন্ট সাইজ এবং ওজন ব্যবহার করা হয়েছে
      • টাকার পরিমাণগুলোকে আরও বিশিষ্টভাবে প্রদর্শন করা হয়েছে
    4. ইন্টারেক্টিভ এলিমেন্ট:

      • কার্ডগুলোর উপর ট্যাপ এফেক্ট যোগ করা হয়েছে
      • বাটনগুলোর ডিজাইন আরও আকর্ষণীয় করা হয়েছে
    5. লে-আউট উন্নতকরণ:

      • সমস্ত এলিমেন্ট সুন্দরভাবে সাজানো হয়েছে
      • উপযুক্ত স্পেসিং এবং প্যাডিং ব্যবহার করা হয়েছে
    6. অতিরিক্ত তথ্য প্রদর্শন:

      • একটি নতুন "মোট সারসংক্ষেপ" সেকশন যোগ করা হয়েছে
      • প্রতিটি স্ট্যাটাসের জন্য ট্রানজেকশনের সংখ্যা এবং মোট পরিমাণ দেখানো হয়েছে

    এই ডিজাইনটি ব্যবহারকারীদের জন্য আরও আকর্ষণীয় এবং ব্যবহারবান্ধব হবে, এবং তথ্যগুলো আরও সুন্দরভাবে উপস্থাপন করবে।

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.