repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/ssp_ce_ltrs
mirrored_repositories/ssp_ce_ltrs/lib/help_page.dart
import 'package:flutter/material.dart'; class HelpPage extends StatefulWidget { const HelpPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.more_horiz), label: 'More', backgroundColor: Colors.purple, ); } class _MyAppState extends State<HelpPage> { _MyAppState() {} @override Widget build(BuildContext context) { return new Scaffold( body: Center( child: Text("More features to come (v.1.0.0)"), ), ); } }
0
mirrored_repositories/ssp_ce_ltrs
mirrored_repositories/ssp_ce_ltrs/lib/app_bar.dart
import 'package:flutter/material.dart'; PreferredSizeWidget appBar() { return AppBar( title: Center( child: Text( "3000 Kata Inggris", style: TextStyle(color: Colors.blueGrey), ), ), backgroundColor: Colors.white, ); }
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/model/card_speech_model.dart
class CardSpeechModel { String category; String cardImage; int cardBackground; String cardPage; CardSpeechModel( this.category, this.cardImage, this.cardBackground, this.cardPage); } List<CardSpeechModel> cardsSpeech = cardData .map((item) => CardSpeechModel( item['category'].toString(), item['cardImage'].toString(), int.parse(item['cardBackground'].toString()), item['cardPage'].toString())) .toList(); // add titlefont color, title fontstyle, cardbackgroundcolor var cardData = [ { "category": "Hewan", "cardImage": "head_img_animal.png", "cardBackground": 0xFF1E1E99, "cardPage": "/animalSpeechPage" }, { "category": "KendaraAn", "cardImage": "head_img_vehicle.png", "cardBackground": 0xFFFF70A3, "cardPage": "/vehicleSpeechPage" }, { "category": "Peralatan Rumah", "cardImage": "head_img_household.png", "cardBackground": 0xFFFF0000, "cardPage": "/householdSpeechPage" }, { "category": "Warna-warni", "cardImage": "head_img_color.png", "cardBackground": 0xFF7a7a7a, "cardPage": "/colorSpeechPage" }, { "category": "Bentuk 2 Dimensi", "cardImage": "head_img_shape2d.png", "cardBackground": 0xFF00ffff, "cardPage": "/shape2DSpeechPage" }, { "category": "Bentuk 3 Dimensi", "cardImage": "head_img_shape3d.png", "cardBackground": 0xFFffd700, "cardPage": "/shape3DSpeechPage" }, { "category": "Huruf", "cardImage": "head_img_letter.png", "cardBackground": 0xFF4b0082, "cardPage": "/letterSpeechPage" }, { "category": "Angka", "cardImage": "head_img_number.png", "cardBackground": 0xFF00ff3b, "cardPage": "/numberSpeechPage" } ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/model/card1_model.dart
import 'package:ssp_ce_ltrs/speech_home_page.dart'; class Card1Model { String cardImage; String cardTitle; int cardBackground; String cardPage; Card1Model( this.cardImage, this.cardTitle, this.cardBackground, this.cardPage); } List<Card1Model> cards1 = cardData .map((item) => Card1Model( item['cardImage'].toString(), item['cardTitle'].toString(), int.parse(item['cardBackground'].toString()), item['cardPage'].toString())) .toList(); var cardData = [ { "cardImage": "logo_mengenalkata.png", "cardTitle": "Latihan Berbicara", "cardBackground": 0xFF1E1E99, "cardPage": "/speechHomePage" } /*, { "cardImage": "new-feature-soon.png", "cardTitle": "Informasi lainnya", "cardBackground": 0xFFFF70A3, "cardPage": "" }*/ ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/speech_page_layout.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/component_wrapper.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; Widget buildSpeechPageLayout(BuildContext buildContext, List<Sound> soundsData, [int? numButtonPerRowPortrait, int? numButtonPerRowLandscape]) { double screenWidth = MediaQuery.of(buildContext).size.width; double screenHeight = MediaQuery.of(buildContext).size.height; Orientation orientation = MediaQuery.of(buildContext).orientation; double bigButtonHeight = 0; double separatorSize = 0; double titleSize = 0; if (orientation == Orientation.portrait) { bigButtonHeight = screenHeight * 0.85; separatorSize = screenHeight * 0.02; titleSize = screenHeight * 0.07; } else { bigButtonHeight = screenHeight * 0.80; separatorSize = screenHeight * 0.05; titleSize = screenHeight * 0.08; } return Column( children: [ Container( height: titleSize, margin: EdgeInsets.only( left: separatorSize, top: separatorSize, right: separatorSize), child: Row( children: [ GestureDetector( child: Icon( Icons.chevron_left_rounded, size: titleSize, ), onTap: () { ComponentWrapper.instance.audioCache2.play("button-tap.wav"); Navigator.pop(buildContext); }, ) ], ), ), SizedBox( height: separatorSize, ), Container( height: bigButtonHeight, child: Column( children: ComponentWrapper.instance.soundPopulator.populateData( soundsData, MediaQuery.of(buildContext).orientation, numButtonPerRowPortrait, numButtonPerRowLandscape)), ), ], ); } Widget buildSpeechPageLayout2(BuildContext buildContext, List<Sound> soundsData, [int? numButtonPerRowPortrait, int? numButtonPerRowLandscape]) { double screenWidth = MediaQuery.of(buildContext).size.width; double screenHeight = MediaQuery.of(buildContext).size.height; Orientation orientation = MediaQuery.of(buildContext).orientation; double bigButtonHeight = 0; double separatorSize = 0; double titleSize = 0; if (orientation == Orientation.portrait) { bigButtonHeight = screenHeight * 0.85; separatorSize = screenHeight * 0.02; titleSize = screenHeight * 0.07; } else { bigButtonHeight = screenHeight * 0.80; separatorSize = screenHeight * 0.05; titleSize = screenHeight * 0.08; } return Column( children: [ Container( height: titleSize, margin: EdgeInsets.only( left: separatorSize, top: separatorSize, right: separatorSize), child: Row( children: [ GestureDetector( child: Icon( Icons.chevron_left_rounded, size: titleSize, ), onTap: () { ComponentWrapper.instance.audioCache2.play("button-tap.wav"); Navigator.pop(buildContext); }, ) ], ), ), SizedBox( height: separatorSize, ), Container( height: bigButtonHeight, child: ComponentWrapper.instance.soundPopulator.populateData2( buildContext, soundsData, MediaQuery.of(buildContext).orientation, numButtonPerRowPortrait, numButtonPerRowLandscape), ), ], ); }
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/letter_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class LetterSpeechPage extends StatefulWidget { const LetterSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.train), label: 'Kendaraan', backgroundColor: Colors.blue, ); } class _MyAppState extends State<LetterSpeechPage> { List<Flexible> dataPerRow = []; final SoundPopulator soundPopulator = SoundPopulator(); @override Widget build(BuildContext buildContext) { return Scaffold( body: Container( decoration: BoxDecoration( color: Colors.deepOrange, ), child: buildSpeechPageLayout(buildContext, soundsData, 3, 7), ), ); } } final List<Sound> soundsData = [ Sound.textDisplay( "11", "letter", "a", "a.mp3", Colors.lightBlue, Colors.black), Sound.textDisplay( "12", "letter", "b", "b.mp3", Colors.lightGreen, Colors.black), Sound.textDisplay( "13", "letter", "c", "c.mp3", Colors.yellowAccent, Colors.black), Sound.textDisplay( "14", "letter", "d", "d.mp3", Colors.redAccent, Colors.black), Sound.textDisplay( "15", "letter", "e", "e.mp3", Colors.deepOrange, Colors.black), Sound.textDisplay( "16", "letter", "f", "f.mp3", Colors.cyanAccent, Colors.black), Sound.textDisplay( "17", "letter", "g", "g.mp3", Colors.indigoAccent, Colors.black), Sound.textDisplay( "18", "letter", "h", "h.mp3", Colors.tealAccent, Colors.black), Sound.textDisplay( "19", "letter", "i", "i.mp3", Colors.pinkAccent, Colors.black), Sound.textDisplay( "20", "letter", "j", "j.mp3", Colors.limeAccent, Colors.black), Sound.textDisplay( "11", "letter", "k", "k.mp3", Colors.lightBlue, Colors.black), Sound.textDisplay( "12", "letter", "l", "l.mp3", Colors.lightGreen, Colors.black), Sound.textDisplay( "13", "letter", "m", "m.mp3", Colors.yellowAccent, Colors.black), Sound.textDisplay( "14", "letter", "n", "n.mp3", Colors.redAccent, Colors.black), Sound.textDisplay( "15", "letter", "o", "o.mp3", Colors.deepOrange, Colors.black), Sound.textDisplay( "16", "letter", "p", "p.mp3", Colors.cyanAccent, Colors.black), Sound.textDisplay( "17", "letter", "q", "q.mp3", Colors.indigoAccent, Colors.black), Sound.textDisplay( "18", "letter", "r", "r.mp3", Colors.tealAccent, Colors.black), Sound.textDisplay( "19", "letter", "s", "s.mp3", Colors.pinkAccent, Colors.black), Sound.textDisplay( "20", "letter", "t", "t.mp3", Colors.limeAccent, Colors.black), Sound.textDisplay( "11", "letter", "u", "u.mp3", Colors.lightBlue, Colors.black), Sound.textDisplay( "12", "letter", "v", "v.mp3", Colors.lightGreen, Colors.black), Sound.textDisplay( "13", "letter", "w", "w.mp3", Colors.yellowAccent, Colors.black), Sound.textDisplay( "14", "letter", "x", "x.mp3", Colors.redAccent, Colors.black), Sound.textDisplay( "15", "letter", "y", "y.mp3", Colors.deepOrange, Colors.black), Sound.textDisplay( "16", "letter", "z", "z.mp3", Colors.cyanAccent, Colors.black) ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/shape3d_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class Shape3DSpeechPage extends StatefulWidget { const Shape3DSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.adb), label: 'Bentuk 3D', backgroundColor: Colors.teal, ); } class _MyAppState extends State<Shape3DSpeechPage> { @override Widget build(BuildContext buildContext) { return Scaffold( body: Container( decoration: BoxDecoration( color: Colors.redAccent, ), child: buildSpeechPageLayout(buildContext, soundsData, 2, 4), ), ); } } final List<Sound> soundsData = [ Sound.svgDisplay("1", "shape3d", "kubus", "kubus.mp3", "shape3d_cube.svg", Colors.redAccent, Colors.black), Sound.svgDisplay("2", "shape3d", "balok", "balok.mp3", "shape3d_block.svg", Colors.orangeAccent, Colors.black), Sound.svgDisplay("3", "shape3d", "kerucut", "kerucut.mp3", "shape3d_cone.svg", Colors.yellowAccent, Colors.black), Sound.svgDisplay("4", "shape3d", "prismasegitiga", "prismasegitiga.mp3", "shape3d_triangle_3d.svg", Colors.greenAccent, Colors.black), Sound.svgDisplay("5", "shape3d", "limas", "limas.mp3", "shape3d_pyramid.svg", Colors.blueAccent, Colors.black), Sound.svgDisplay("6", "shape3d", "prismasegilima", "prismasegilima.mp3", "shape3d_cylinder-5.svg", Colors.purpleAccent, Colors.black), Sound.svgDisplay("7", "shape3d", "tabung", "tabung.mp3", "shape3d_cylinder.svg", Colors.lime, Colors.black), Sound.svgDisplay("8", "shape3d", "bola", "bola.mp3", "shape3d_ball.svg", Colors.lightGreen, Colors.black) ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/animal_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/component_wrapper.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class AnimalSpeechPage extends StatefulWidget { const AnimalSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.adb), label: 'Hewan', backgroundColor: Colors.red, ); } class _MyAppState extends State<AnimalSpeechPage> { final SoundPopulator soundPopulator = SoundPopulator(); @override Widget build(BuildContext buildContext) { double screenWidth = MediaQuery.of(buildContext).size.width; double screenHeight = MediaQuery.of(buildContext).size.height; Orientation orientation = MediaQuery.of(buildContext).orientation; double bigButtonHeight = 0; double bigButtonWidth = 0; double separatorSize = 0; double titleSize = 0; if (orientation == Orientation.portrait) { bigButtonHeight = screenHeight * 0.85; bigButtonWidth = screenWidth * 0.85; separatorSize = screenHeight * 0.02; titleSize = screenHeight * 0.07; } else { bigButtonHeight = screenHeight * 0.80; bigButtonWidth = screenWidth * 0.80; separatorSize = screenHeight * 0.05; titleSize = screenHeight * 0.08; } return Scaffold( body: Container( decoration: BoxDecoration( image: DecorationImage( image: AssetImage("assets/images/bg-farm.jpg"), fit: BoxFit.cover, ), ), child: buildSpeechPageLayout(buildContext, soundsData), ), ); } } final List<Sound> soundsData = [ Sound.imageDisplay( "1", "animal", "ayam", "ayam.mp3", "chicken.png", Colors.blue), Sound.imageDisplay( "2", "animal", "sapi", "sapi.mp3", "cow.png", Colors.green), Sound.imageDisplay( "3", "animal", "kuda", "kuda.mp3", "horse.png", Colors.yellow), Sound.imageDisplay( "4", "animal", "anjing", "anjing.mp3", "dog.png", Colors.red), Sound.imageDisplay( "5", "animal", "kucing", "kucing.mp3", "cat.png", Colors.orange), Sound.imageDisplay( "6", "animal", "domba", "domba.mp3", "sheep.png", Colors.deepOrange), Sound.imageDisplay("7", "animal", "burung kenari", "burung.mp3", "canary.png", Colors.indigo), Sound.imageDisplay( "8", "animal", "gajah", "gajah.mp3", "elephant.png", Colors.teal), Sound.imageDisplay( "9", "animal", "hamster", "hamster.mp3", "hamster.png", Colors.pink), Sound.imageDisplay( "10", "animal", "singa", "singa.mp3", "lion.png", Colors.lime) ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/number_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class NumberSpeechPage extends StatefulWidget { const NumberSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.train), label: 'Kendaraan', backgroundColor: Colors.blue, ); } class _MyAppState extends State<NumberSpeechPage> { @override Widget build(BuildContext buildContext) { return Scaffold( body: Container( decoration: BoxDecoration( color: Colors.lime, ), child: buildSpeechPageLayout(buildContext, soundsData), ), ); } } final List<Sound> soundsData = [ Sound.textDisplay( "11", "number", "1", "satu.mp3", Colors.lightBlue, Colors.black), Sound.textDisplay( "12", "number", "2", "dua.mp3", Colors.lightGreen, Colors.black), Sound.textDisplay( "13", "number", "3", "tiga.mp3", Colors.yellowAccent, Colors.black), Sound.textDisplay( "14", "number", "4", "empat.mp3", Colors.redAccent, Colors.black), Sound.textDisplay( "15", "number", "5", "lima.mp3", Colors.deepOrange, Colors.black), Sound.textDisplay( "16", "number", "6", "enam.mp3", Colors.cyanAccent, Colors.black), Sound.textDisplay( "17", "number", "7", "tujuh.mp3", Colors.indigoAccent, Colors.black), Sound.textDisplay( "18", "number", "8", "delapan.mp3", Colors.tealAccent, Colors.black), Sound.textDisplay( "19", "number", "9", "sembilan.mp3", Colors.pinkAccent, Colors.black), Sound.textDisplay( "20", "number", "0", "nol.mp3", Colors.limeAccent, Colors.black) ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/shape2d_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class Shape2DSpeechPage extends StatefulWidget { const Shape2DSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.adb), label: 'Bentuk 2D', backgroundColor: Colors.lightBlueAccent, ); } class _MyAppState extends State<Shape2DSpeechPage> { List<Flexible> dataPerRow = []; final SoundPopulator soundPopulator = SoundPopulator(); @override Widget build(BuildContext buildContext) { return Scaffold( body: Container( decoration: BoxDecoration( color: Colors.blueAccent, ), child: buildSpeechPageLayout(buildContext, soundsData), ), ); } } final List<Sound> soundsData = [ Sound.svgDisplay("1", "shape2d", "bujursangkar", "bujursangkar.mp3", "square.svg", Colors.red, Colors.black), Sound.svgDisplay("2", "shape2d", "lingkaran", "lingkaran.mp3", "circle.svg", Colors.orange, Colors.black), Sound.svgDisplay("4", "shape2d", "segilima", "segilima.mp3", "pentagon.svg", Colors.green, Colors.black), Sound.svgDisplay("6", "shape2d", "jajargenjang", "jajargenjang.mp3", "parallelogram.svg", Colors.purple, Colors.black), Sound.svgDisplay("7", "shape2d", "trapesium", "trapesium.mp3", "trapezoid.svg", Colors.cyan, Colors.black), Sound.svgDisplay("8", "shape2d", "oval", "oval.mp3", "oval.svg", Colors.white, Colors.black), Sound.svgDisplay("9", "shape2d", "belahketupat", "belahketupat.mp3", "diamond.svg", Colors.brown, Colors.black), Sound.svgDisplay("10", "shape2d", "segitiga", "segitiga.mp3", "triangle.svg", Colors.pink, Colors.black), /* Sound.svgDisplay("3", "shape2d", "persegipanjang", "persegipanjang.mp3", "rectangle.svg", Colors.yellow, Colors.black), Sound.svgDisplay("5", "shape2d", "setengahlingkaran", "setengahlingkaran.mp3", "halfcircle.svg", Colors.blue, Colors.black), */ ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/vehicle_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class VehicleSpeechPage extends StatefulWidget { const VehicleSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.train), label: 'Kendaraan', backgroundColor: Colors.blue, ); } class _MyAppState extends State<VehicleSpeechPage> { @override Widget build(BuildContext buildContext) { return Scaffold( body: Container( decoration: BoxDecoration( color: Colors.tealAccent, ), child: buildSpeechPageLayout(buildContext, soundsData), ), ); } } final List<Sound> soundsData = [ Sound.imageDisplay( "11", "vehicle", "mobil", "mobil.mp3", "car.png", Colors.lightBlue), Sound.imageDisplay("12", "vehicle", "motor", "motor.mp3", "motorcycle.png", Colors.lightGreen), Sound.imageDisplay("13", "vehicle", "kereta api", "kereta-api.mp3", "train.png", Colors.yellowAccent), Sound.imageDisplay("14", "vehicle", "helikopter", "helikopter.mp3", "helicopter.png", Colors.redAccent), Sound.imageDisplay( "15", "vehicle", "kapal", "kapal.mp3", "ship.png", Colors.deepOrange), Sound.imageDisplay("16", "vehicle", "pesawat terbang", "pesawat.mp3", "plane.png", Colors.cyanAccent), Sound.imageDisplay("17", "vehicle", "ambulans", "ambulans.mp3", "ambulance.png", Colors.indigoAccent), Sound.imageDisplay("18", "vehicle", "sepeda", "sepeda.mp3", "bicycle.png", Colors.tealAccent), Sound.imageDisplay( "19", "vehicle", "bis", "bis.mp3", "bus.png", Colors.pinkAccent), Sound.imageDisplay("20", "vehicle", "mobil polisi", "mobil-polisi.mp3", "police-car.png", Colors.limeAccent) ];
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/household_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class HouseholdSpeechPage extends StatefulWidget { const HouseholdSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.house_siding), label: 'Benda Rumah', backgroundColor: Colors.green, ); } class _MyAppState extends State<HouseholdSpeechPage> { @override Widget build(BuildContext buildContext) { return Scaffold( body: Container( decoration: BoxDecoration( color: Colors.lightGreen, ), child: buildSpeechPageLayout(buildContext, soundsData), ), ); } } final List<Sound> soundsData = [ Sound.imageDisplay( "21", "household", "keran", "keran.mp3", "tap.png", Colors.purple), Sound.imageDisplay( "22", "household", "bel", "bel.mp3", "bell.png", Colors.lightGreenAccent), Sound.imageDisplay("23", "household", "jam weker", "jamweker.mp3", "alarm.png", Colors.deepOrangeAccent), Sound.imageDisplay( "24", "household", "toilet", "toilet.mp3", "toilet.png", Colors.amber), Sound.imageDisplay("25", "household", "teko", "teko.mp3", "kettle.png", Colors.lightBlueAccent), Sound.imageDisplay("26", "household", "pisau", "pisau.mp3", "knife.png", Colors.indigoAccent), Sound.imageDisplay( "27", "household", "sapu", "sapu.mp3", "broom.png", Colors.amberAccent), Sound.imageDisplay("28", "household", "kulkas", "kulkas.mp3", "refrigerator.png", Colors.deepOrangeAccent), Sound.imageDisplay("29", "household", "saklar", "saklar.mp3", "switch.png", Colors.deepPurple), Sound.imageDisplay( "30", "household", "kompor", "kompor.mp3", "stove.png", Colors.brown) ]; // bor, gerinda, gergaji mesin, paku, kunci
0
mirrored_repositories/ssp_ce_ltrs/lib
mirrored_repositories/ssp_ce_ltrs/lib/learn_speech/color_speech_page.dart
import 'package:flutter/material.dart'; import 'package:ssp_ce_ltrs/learn_speech/speech_page_layout.dart'; import 'package:ssp_ce_ltrs/sound.dart'; import 'package:ssp_ce_ltrs/sound_populator.dart'; class ColorSpeechPage extends StatefulWidget { const ColorSpeechPage({Key? key}) : super(key: key); @override _MyAppState createState() => _MyAppState(); static const BottomNavigationBarItem getNavBarItem = BottomNavigationBarItem( icon: Icon(Icons.adb), label: 'Warna', backgroundColor: Colors.lightBlueAccent, ); } class _MyAppState extends State<ColorSpeechPage> { List<Flexible> dataPerRow = []; final SoundPopulator soundPopulator = SoundPopulator(); @override Widget build(BuildContext buildContext) { return Scaffold( body: Container( decoration: BoxDecoration( color: Colors.white54, ), child: buildSpeechPageLayout(buildContext, soundsData), ), ); } } final List<Sound> soundsData = [ Sound.imageDisplay( "1", "color", "merah", "merah.mp3", "transparent.png", Colors.red), Sound.imageDisplay( "2", "color", "oranye", "oranye.mp3", "transparent.png", Colors.orange), Sound.imageDisplay( "3", "color", "kuning", "kuning.mp3", "transparent.png", Colors.yellow), Sound.imageDisplay( "4", "color", "hijau", "hijau.mp3", "transparent.png", Colors.green), Sound.imageDisplay( "5", "color", "biru", "biru.mp3", "transparent.png", Colors.blue), Sound.imageDisplay( "6", "color", "ungu", "ungu.mp3", "transparent.png", Colors.purple), Sound.imageDisplay( "7", "color", "hitam", "hitam.mp3", "transparent.png", Colors.black), Sound.imageDisplay( "8", "color", "putih", "putih.mp3", "transparent.png", Colors.white), Sound.imageDisplay( "9", "color", "coklat", "coklat.mp3", "transparent.png", Colors.brown), Sound.imageDisplay( "10", "color", "pink", "pink.mp3", "transparent.png", Colors.pink) ];
0
mirrored_repositories/ssp_ce_ltrs
mirrored_repositories/ssp_ce_ltrs/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:ssp_ce_ltrs/home_page.dart'; import 'package:ssp_ce_ltrs/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const HomePage()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/flow
mirrored_repositories/flow/lib/main.dart
import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:intl/intl.dart' as intl; import 'package:percent_indicator/percent_indicator.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() { runApp(const FlowApp()); } class FlowApp extends StatelessWidget { const FlowApp({super.key}); @override Widget build(BuildContext context) { return AdaptiveTheme( light: ThemeData.light(useMaterial3: true), dark: ThemeData.dark(useMaterial3: true), initial: AdaptiveThemeMode.dark, builder: (theme, dark_theme) => MaterialApp( title: "Flow", theme: theme, darkTheme: dark_theme, home: const FlowTimerPage(), ), ); } } class FlowTimerPage extends StatefulWidget { const FlowTimerPage({super.key}); @override State<FlowTimerPage> createState() => _FlowTimerPageState(); } class AppConfigs { double get rest_ratio => _data["flow.rest_ratio"]?.toDouble() ?? 20; void set rest_ratio(double val) { _data["flow.rest_ratio"] = val; _prefs.then((prefs) => prefs.setDouble("flow.rest_ratio", val)); } bool get auto_start_rest => _data["flow.auto_start_rest"] ?? false; void set auto_start_rest(bool val) { _set_bool("flow.auto_start_rest", val); } bool get swap_flow_buttons => _data["flow.swap_flow_buttons"] ?? false; void set swap_flow_buttons(bool val) { _set_bool("flow.swap_flow_buttons", val); } bool get swap_rest_buttons => _data["flow.swap_rest_buttons"] ?? false; void set swap_rest_buttons(bool val) { _set_bool("flow.swap_rest_buttons", val); } void _set_bool(String key, bool val) { _data[key] = val; _prefs.then((prefs) => prefs.setBool(key, val)); } void _set_double(String key, double val) { _data[key] = val; _prefs.then((prefs) => prefs.setDouble(key, val)); } bool get theme_dark => _data["flow.theme_dark"] ?? true; void set theme_dark(bool val) { _data["flow.theme_dark"] = val; _prefs.then((prefs) => prefs.setBool("flow.theme_dark", val)); } final Map<String, dynamic> _data = {}; final Future<SharedPreferences> _prefs = SharedPreferences.getInstance(); Future<void> init() async { final SharedPreferences prefs = await _prefs; _data["flow.rest_ratio"] = prefs.getDouble("flow.rest_ratio")?.toDouble() ?? 20; _data["flow.auto_start_rest"] = prefs.getBool("flow.auto_start_rest") ?? false; _data["flow.swap_flow_buttons"] = prefs.getBool("flow.swap_flow_buttons") ?? false; _data["flow.swap_rest_buttons"] = prefs.getBool("flow.swap_rest_buttons") ?? false; } } enum TimerMode { FLOW, REST, } enum TimerState { STOP, PAUSE, ACTIVE, } enum Page { TIMER, CONFIGS, } class _FlowTimerPageState extends State<FlowTimerPage> { final Duration _timer_interval = Duration(milliseconds: 50); Timer? _timer; final AppConfigs configs = AppConfigs(); FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); int _flow_time = 0; int _rest_time = 0; int _rest_max = 0; TimerMode _timer_mode = TimerMode.FLOW; TimerState _timer_state = TimerState.STOP; Page page = Page.TIMER; @override void initState() { _timer = Timer.periodic(_timer_interval, (timer) { if (_timer_state == TimerState.ACTIVE) { update_time_spent(_timer_interval.inMilliseconds); } }); const LinuxInitializationSettings notify_linux = LinuxInitializationSettings(defaultActionName: "Start Flow"); const InitializationSettings notify_settings = InitializationSettings(linux: notify_linux); flutterLocalNotificationsPlugin.initialize(notify_settings, onDidReceiveNotificationResponse: (response) { if (_timer_mode == TimerMode.FLOW && _timer_state == TimerState.STOP) { _on_start_pressed(); } }); configs.init().then((value) => setState(() {})); super.initState(); } void update_time_spent(int amount) { setState(() { _flow_time += amount; _rest_time = max(_rest_time - amount, 0); if (_timer_mode == TimerMode.REST && _timer_state == TimerState.ACTIVE && _rest_time <= 0) { _flow_time = 0; _timer_state = TimerState.STOP; _timer_mode = TimerMode.FLOW; flutterLocalNotificationsPlugin.show( 0, "Rest is over!", "Let's get back to flow.", null); } }); } String format_time(int time) { int seconds = time ~/ 1000; seconds = seconds % (24 * 3600); int hour = seconds ~/ 3600; seconds %= 3600; int minutes = seconds ~/ 60; seconds %= 60; intl.NumberFormat fmt = intl.NumberFormat("00"); return "${hour <= 1 ? "${fmt.format(hour)}:" : ""}${fmt.format(minutes)}:${hour <= 1 ? "${fmt.format(seconds)}" : ""}"; } void _on_start_pressed() { setState(() { switch (_timer_state) { case TimerState.ACTIVE: _timer_state = TimerState.PAUSE; break; case TimerState.PAUSE: _timer_state = TimerState.ACTIVE; break; case TimerState.STOP: switch (_timer_mode) { case TimerMode.FLOW: _flow_time = 0; _timer_state = TimerState.ACTIVE; break; case TimerMode.REST: _timer_state = TimerState.ACTIVE; break; } } }); } void _on_next_pressed() { setState(() { switch (_timer_mode) { case TimerMode.FLOW: _timer_state = TimerState.STOP; _rest_max = _flow_time * (configs.rest_ratio / 100) ~/ 1; _rest_time = _rest_max; _timer_mode = TimerMode.REST; if (configs.auto_start_rest) { _timer_state = TimerState.ACTIVE; } break; case TimerMode.REST: _timer_state = TimerState.STOP; _flow_time = 0; _timer_mode = TimerMode.FLOW; break; } }); } @override Widget build(BuildContext context) { return Scaffold( floatingActionButton: Padding( padding: const EdgeInsets.only(top: 5.0, left: 0.0), child: Row(children: [ IconButton( onPressed: () => setState(() { page = page == Page.TIMER ? Page.CONFIGS : Page.TIMER; }), //backgroundColor: Colors.transparent, icon: Icon( page == Page.TIMER ? Icons.settings : Icons.arrow_back_ios_new), ), IconButton( onPressed: () { if (configs.theme_dark) { configs.theme_dark = false; AdaptiveTheme.of(context).setLight(); } else { configs.theme_dark = true; AdaptiveTheme.of(context).setDark(); } }, icon: const Icon(Icons.dark_mode), ) ]), ), floatingActionButtonLocation: FloatingActionButtonLocation.miniStartTop, body: page == Page.TIMER ? Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ CircularPercentIndicator( radius: 94, lineWidth: 12, percent: _timer_mode == TimerMode.FLOW ? 0.0 : _rest_time / _rest_max, backgroundWidth: 8, circularStrokeCap: CircularStrokeCap.round, progressColor: _timer_mode == TimerMode.FLOW ? Colors.transparent : Colors.green, backgroundColor: Colors.black.withAlpha((255 * 0.2) ~/ 1), center: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( format_time(_timer_mode == TimerMode.FLOW ? _flow_time : _rest_time), style: Theme.of(context).textTheme.headlineLarge, ), Text( _timer_mode == TimerMode.FLOW ? "Flow time" : "Rest time", ), ], ), ), const SizedBox(height: 10), Directionality( textDirection: _timer_mode == TimerMode.FLOW ? (configs.swap_flow_buttons ? TextDirection.ltr : TextDirection.rtl) : (configs.swap_rest_buttons ? TextDirection.ltr : TextDirection.rtl), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ _timer_state == TimerState.ACTIVE ? IconButton( onPressed: _timer_mode == TimerMode.REST && _rest_time <= 0 ? null : _on_start_pressed, icon: const Icon(Icons.pause), ) : IconButton.filled( onPressed: _timer_mode == TimerMode.REST && _rest_time <= 0 ? null : _on_start_pressed, icon: const Icon(Icons.play_arrow), ), const SizedBox(width: 10), OutlinedButton.icon( onPressed: _timer_mode == TimerMode.FLOW && _flow_time <= 1 ? null : _on_next_pressed, icon: Icon( _timer_mode == TimerMode.FLOW ? Icons.restore : Icons.skip_next, ), label: Text( _timer_mode == TimerMode.FLOW ? "Rest" : "Skip"), ) ], ), ) ], ), ) : Column( children: [ const SizedBox(height: 45), Expanded( child: ListView( children: [ SwitchListTile( value: configs.auto_start_rest, title: const Text("Autostart Rest timer"), subtitle: const Text( "Automatically start the timer when Rest is pressed."), onChanged: (enabled) => setState( () { configs.auto_start_rest = enabled; }, ), ), ListTile( title: const Text("Rest timer factor"), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( "The percentage of Flow time that will be used as Rest time."), Slider( value: configs.rest_ratio, secondaryTrackValue: 20, min: 1, max: 100, divisions: 99, label: "${configs.rest_ratio.round()}%", onChanged: (value) => setState(() { configs.rest_ratio = value.round() * 1; }), ), ], ), trailing: Text("${configs.rest_ratio.round()}%"), ), const Divider(), SwitchListTile( value: configs.swap_flow_buttons, title: const Text("Swap Flow buttons"), onChanged: (enabled) => setState( () { configs.swap_flow_buttons = enabled; }, ), ), SwitchListTile( value: configs.swap_rest_buttons, title: const Text("Swap Rest buttons"), onChanged: (enabled) => setState( () { configs.swap_rest_buttons = enabled; }, ), ), ], ), ) ], ), ); } }
0
mirrored_repositories/flow
mirrored_repositories/flow/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flow/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const FlowApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Weather
mirrored_repositories/Weather/lib/main.dart
import 'package:fever/model/l10n/l10n.dart'; import 'package:fever/model/routes.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:get/get.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return GetMaterialApp( title: 'Fever', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, iconTheme: const IconThemeData( color: Colors.white, ), ), localizationsDelegates: const [ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, Localizationes.delegate, ], supportedLocales: const [ Locale('es', 'ES'), Locale('en', 'US'), ], initialRoute: '/', getPages: routes, ); } }
0
mirrored_repositories/Weather/lib/view
mirrored_repositories/Weather/lib/view/home/home_page.dart
import 'package:fever/controller/home/home_controller.dart'; import 'package:fever/model/ui/f_progress_hud.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) { return GetBuilder<HomeController>( init: HomeController(), builder: (_) { return Scaffold( body: FProgressHUD( loading: _.isLoading, child: SafeArea( top: false, child: Container( decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Colors.grey, Colors.white, ], tileMode: TileMode.mirror, ), ), child: Padding( padding: const EdgeInsets.all(8.0), child: Stack( children: [ Positioned( top: 120, left: 0, right: 0, child: SingleChildScrollView( child: SizedBox( width: double.infinity, child: Column( children: [ Column( children: [ InkWell( onTap: () => _.getCitySelect(), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon( Icons.location_on_outlined, color: Colors.white, size: 24, ), const SizedBox( width: 5, ), Text( _.cityName, style: const TextStyle().copyWith( color: Colors.white, fontSize: 35), ), const SizedBox( width: 5, ), const Icon( Icons.arrow_drop_down_outlined, color: Colors.white, size: 24, ), ], ), ), const SizedBox( height: 10, ), Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Min: ${_.minGrados}', style: const TextStyle().copyWith( color: Colors.white, fontSize: 16, ), ), const SizedBox( width: 30, ), Text( 'Max: ${_.maxGrados}', style: const TextStyle().copyWith( color: Colors.white, fontSize: 16, ), ), ], ), ], ), const SizedBox( height: 10, ), Row( children: [ Image.network( _.image, scale: 1, ), Text( _.grados, style: const TextStyle().copyWith( color: Colors.white, fontSize: 80), ), ], ), const SizedBox( height: 40, ), Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ const Icon(Icons.air), const SizedBox( height: 5, ), Text( _.viento, style: const TextStyle().copyWith( color: Colors.white, fontSize: 16, ), ), ], ), Column( children: [ const Icon(Icons.waves), const SizedBox( height: 5, ), Text( _.humedad, style: const TextStyle().copyWith( color: Colors.white, fontSize: 16, ), ), ], ), Column( children: [ const Icon(Icons.umbrella_outlined), const SizedBox( height: 5, ), Text( _.lluvia, style: const TextStyle().copyWith( color: Colors.white, fontSize: 16, ), ), ], ), ], ), const SizedBox( height: 40, ), ], ), ), ), ), Positioned( top: 55, right: 0, left: 0, child: Container( color: Colors.transparent, height: 30, width: double.infinity, child: Padding( padding: const EdgeInsets.all(8.0), child: Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end, children: [ IconButton( onPressed: () => _.getCitySelect(), icon: const Icon( Icons.search, color: Colors.white, ), ) ], ), ), ), ) ], ), ), ), ), ), ); }, ); } }
0
mirrored_repositories/Weather/lib/view
mirrored_repositories/Weather/lib/view/splash/splash_page.dart
import 'package:fever/controller/splash/splash_controller.dart'; import 'package:fever/model/colors.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; class SplashPage extends StatelessWidget { const SplashPage({super.key}); @override Widget build(BuildContext context) { // TODO: implement build return GetBuilder<SplashController>( init: SplashController(), builder: (context) { return Scaffold( body: Container( decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ FColors.blue1, Colors.white, ], tileMode: TileMode.mirror, ), ), child: Center( child: Image.asset('assets/images/logo.png'), ), ), ); }); } }
0
mirrored_repositories/Weather/lib
mirrored_repositories/Weather/lib/model/climate.dart
import 'dart:convert'; Climate climateFromJson(String str) => Climate.fromJson(json.decode(str)); String climateToJson(Climate data) => json.encode(data.toJson()); class Climate { Climate({ required this.coord, required this.weather, required this.base, required this.main, required this.visibility, required this.wind, required this.clouds, required this.dt, required this.sys, required this.timezone, required this.id, required this.name, required this.cod, }); Coord coord; List<Weather> weather; String base; Main main; int visibility; Wind wind; Clouds clouds; int dt; Sys sys; int timezone; int id; String name; int cod; factory Climate.fromJson(Map<String, dynamic> json) => Climate( coord: Coord.fromJson(json["coord"]), weather: List<Weather>.from(json["weather"].map((x) => Weather.fromJson(x))), base: json["base"], main: Main.fromJson(json["main"]), visibility: json["visibility"], wind: Wind.fromJson(json["wind"]), clouds: Clouds.fromJson(json["clouds"]), dt: json["dt"], sys: Sys.fromJson(json["sys"]), timezone: json["timezone"], id: json["id"], name: json["name"], cod: json["cod"], ); Map<String, dynamic> toJson() => { "coord": coord.toJson(), "weather": List<dynamic>.from(weather.map((x) => x.toJson())), "base": base, "main": main.toJson(), "visibility": visibility, "wind": wind.toJson(), "clouds": clouds.toJson(), "dt": dt, "sys": sys.toJson(), "timezone": timezone, "id": id, "name": name, "cod": cod, }; } class Clouds { Clouds({ required this.all, }); int all; factory Clouds.fromJson(Map<String, dynamic> json) => Clouds( all: json["all"], ); Map<String, dynamic> toJson() => { "all": all, }; } class Coord { Coord({ required this.lon, required this.lat, }); double lon; double lat; factory Coord.fromJson(Map<String, dynamic> json) => Coord( lon: json["lon"]?.toDouble(), lat: json["lat"]?.toDouble(), ); Map<String, dynamic> toJson() => { "lon": lon, "lat": lat, }; } class Main { Main({ required this.temp, required this.feelsLike, required this.tempMin, required this.tempMax, required this.pressure, required this.humidity, }); double temp; double feelsLike; double tempMin; double tempMax; int pressure; int humidity; factory Main.fromJson(Map<String, dynamic> json) => Main( temp: json["temp"]?.toDouble(), feelsLike: json["feels_like"]?.toDouble(), tempMin: json["temp_min"]?.toDouble(), tempMax: json["temp_max"]?.toDouble(), pressure: json["pressure"], humidity: json["humidity"], ); Map<String, dynamic> toJson() => { "temp": temp, "feels_like": feelsLike, "temp_min": tempMin, "temp_max": tempMax, "pressure": pressure, "humidity": humidity, }; } class Sys { Sys({ required this.type, required this.id, required this.country, required this.sunrise, required this.sunset, }); int type; int id; String country; int sunrise; int sunset; factory Sys.fromJson(Map<String, dynamic> json) => Sys( type: json["type"], id: json["id"], country: json["country"], sunrise: json["sunrise"], sunset: json["sunset"], ); Map<String, dynamic> toJson() => { "type": type, "id": id, "country": country, "sunrise": sunrise, "sunset": sunset, }; } class Weather { Weather({ required this.id, required this.main, required this.description, required this.icon, }); int id; String main; String description; String icon; factory Weather.fromJson(Map<String, dynamic> json) => Weather( id: json["id"], main: json["main"], description: json["description"], icon: json["icon"], ); Map<String, dynamic> toJson() => { "id": id, "main": main, "description": description, "icon": icon, }; } class Wind { Wind({ required this.speed, required this.deg, }); double speed; int deg; factory Wind.fromJson(Map<String, dynamic> json) => Wind( speed: json["speed"]?.toDouble(), deg: json["deg"], ); Map<String, dynamic> toJson() => { "speed": speed, "deg": deg, }; }
0
mirrored_repositories/Weather/lib
mirrored_repositories/Weather/lib/model/routes.dart
import 'package:fever/view/home/home_page.dart'; import 'package:fever/view/splash/splash_page.dart'; import 'package:get/get.dart'; final routes = [ GetPage( name: '/', page: () => const SplashPage(), transition: Transition.circularReveal, transitionDuration: const Duration(seconds: 2), ), GetPage( name: '/home', page: () => const HomePage(), transition: Transition.circularReveal, transitionDuration: const Duration(seconds: 2), ), ];
0
mirrored_repositories/Weather/lib
mirrored_repositories/Weather/lib/model/common.dart
class Common { String selectImageUrl(String option) { String _imageUrl = ''; switch (option) { case 'Clouds': _imageUrl = "https://img.icons8.com/fluency/240/null/partly-cloudy-day.png"; break; case 'Clear': _imageUrl = "https://img.icons8.com/fluency/240/null/sun.png"; break; default: _imageUrl = 'https://img.icons8.com/fluency/240/null/sun.png'; break; } return _imageUrl; } }
0
mirrored_repositories/Weather/lib
mirrored_repositories/Weather/lib/model/constants.dart
class WebService { static const String urlBaseClime = "https://api.openweathermap.org"; static const String urlBaseCitys = "https://search.reservamos.mx"; } class EndPoint { static const String base = "/data/2.5/weather"; static const String baseCitys = "/api/v2/places"; } class Id { static const String appId = "61f116a832a497302bcbf933b0172bd6"; }
0
mirrored_repositories/Weather/lib
mirrored_repositories/Weather/lib/model/colors.dart
import 'package:flutter/material.dart'; class FColors { static const yellow = Color(0xFFFFEA11); static const blue = Color(0xFF81CACF); static const blue1 = Color(0xFF5A8F7B); static const blue2 = Color(0xFF355764); }
0
mirrored_repositories/Weather/lib/model
mirrored_repositories/Weather/lib/model/network/network.dart
import 'dart:convert'; import 'package:fever/model/citys/citys.dart'; import 'package:fever/model/climate.dart'; import 'package:fever/model/constants.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; class Network { String _content = ''; Future<List<Citys>> getCitys({ Map<String, dynamic> params = const {}, }) async { List<Citys> citys = []; if (params.isNotEmpty) { _content = '?${(params.keys.map((key) => '$key=${Uri.encodeQueryComponent(params[key])}')).join('&')}'; } try { final Map<String, String> headers = { 'Content-Type': 'application/json', }; debugPrint('${WebService.urlBaseCitys}${EndPoint.baseCitys}$_content'); await http .get( Uri.parse('${WebService.urlBaseCitys}${EndPoint.baseCitys}$_content'), headers: headers, ) .then((response) { if (response.statusCode == 200 || response.statusCode == 201) { debugPrint(response.body.replaceAll('\'', '')); List<dynamic> responseJson = jsonDecode(response.body.replaceAll('\'', '')); for (var element in responseJson) { citys.add(Citys.fromJson(element)); } } else { debugPrint('Ha ocurrido un error:'); debugPrint(response.statusCode.toString()); } }); } catch (_) { debugPrint(_.toString()); } return citys; } Future<Climate?> getDataClime({ Map<String, dynamic> params = const {}, }) async { Climate? _climate; if (params.isNotEmpty) { _content = '?${(params.keys.map((key) => '$key=${Uri.encodeQueryComponent(params[key])}')).join('&')}'; } try { final Map<String, String> headers = { 'Content-Type': 'application/json', }; debugPrint('${WebService.urlBaseClime}${EndPoint.base}$_content'); await http .get( Uri.parse('${WebService.urlBaseClime}${EndPoint.base}$_content'), headers: headers, ) .then((response) { if (response.statusCode == 200 || response.statusCode == 201) { debugPrint(response.body.replaceAll('\'', '')); _climate = Climate.fromJson(json.decode(response.body.replaceAll('\'', ''))); } else { debugPrint('Ha ocurrido un error:'); debugPrint(response.statusCode.toString()); } }); } catch (_) { debugPrint(_.toString()); } return _climate; } }
0
mirrored_repositories/Weather/lib/model
mirrored_repositories/Weather/lib/model/citys/citys.dart
import 'dart:convert'; List<Citys> citysFromJson(String str) => List<Citys>.from(json.decode(str).map((x) => Citys.fromJson(x))); String citysToJson(List<Citys> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); class Citys { Citys({ required this.id, required this.slug, required this.citySlug, required this.display, required this.asciiDisplay, required this.cityName, required this.cityAsciiName, required this.state, required this.country, this.lat, this.long, required this.resultType, required this.popularity, this.sortCriteria, }); int id; String slug; String citySlug; String display; String asciiDisplay; String cityName; String cityAsciiName; String state; Country country; String? lat; String? long; ResultType resultType; String popularity; double? sortCriteria; factory Citys.fromJson(Map<String, dynamic> json) => Citys( id: json["id"], slug: json["slug"], citySlug: json["city_slug"], display: json["display"], asciiDisplay: json["ascii_display"], cityName: json["city_name"], cityAsciiName: json["city_ascii_name"], state: json["state"], country: countryValues.map[json["country"]]!, lat: json["lat"], long: json["long"], resultType: resultTypeValues.map[json["result_type"]]!, popularity: json["popularity"], sortCriteria: json["sort_criteria"]?.toDouble(), ); Map<String, dynamic> toJson() => { "id": id, "slug": slug, "city_slug": citySlug, "display": display, "ascii_display": asciiDisplay, "city_name": cityName, "city_ascii_name": cityAsciiName, "state": state, "country": countryValues.reverse[country], "lat": lat, "long": long, "result_type": resultTypeValues.reverse[resultType], "popularity": popularity, "sort_criteria": sortCriteria, }; } enum Country { MXICO, UNITED_STATES } final countryValues = EnumValues( {"México": Country.MXICO, "United States": Country.UNITED_STATES}); enum ResultType { CITY, TERMINAL, AIRPORT } final resultTypeValues = EnumValues({ "airport": ResultType.AIRPORT, "city": ResultType.CITY, "terminal": ResultType.TERMINAL }); class EnumValues<T> { Map<String, T> map; late Map<T, String> reverseMap; EnumValues(this.map); Map<T, String> get reverse { reverseMap = map.map((k, v) => MapEntry(v, k)); return reverseMap; } }
0
mirrored_repositories/Weather/lib/model
mirrored_repositories/Weather/lib/model/ui/f_progress_hud.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:fever/model/colors.dart'; import 'package:fever/model/ui/f_circular_progress.dart'; import 'package:flutter/material.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; class FProgressHUD extends StatelessWidget { final bool loading; final Widget child; final bool whitText; final String textLabel; final String urlImage; final Color backGround; const FProgressHUD( {super.key, required this.loading, required this.child, this.whitText = false, this.textLabel = '', this.urlImage = '', this.backGround = Colors.white}); @override Widget build(BuildContext context) { if (whitText) { return Stack( children: [ ModalProgressHUD( inAsyncCall: loading, progressIndicator: FCircularProgress(), color: backGround, opacity: 1.0, child: child, ), loading ? Center( child: Padding( padding: EdgeInsets.only(top: urlImage.isNotEmpty ? 150 : 80), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text(textLabel, style: Theme.of(context) .primaryTextTheme .headline6! .copyWith(color: FColors.blue2)), const SizedBox( height: 16, ), urlImage.isNotEmpty ? CachedNetworkImage( width: 60, height: 60, fit: BoxFit.scaleDown, imageUrl: urlImage, placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => Image.asset( 'assets/images/sinimagen.png', height: 30, fit: BoxFit.cover, ), ) : Container(), ], ), )) : Container() ], ); } else { return ModalProgressHUD( inAsyncCall: loading, progressIndicator: FCircularProgress(), color: Colors.white, child: child, ); } } }
0
mirrored_repositories/Weather/lib/model
mirrored_repositories/Weather/lib/model/ui/f_card.dart
import 'package:flutter/material.dart'; class FCard extends StatelessWidget { const FCard({super.key}); @override Widget build(BuildContext context) { // TODO: implement build return Card( elevation: 5, child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Text( 'Ahora', style: const TextStyle().copyWith( color: Colors.grey, fontSize: 16, ), ), SizedBox( height: 5, ), Image.network( 'https://img.icons8.com/fluency/240/null/sun.png', scale: 4, ), SizedBox( height: 5, ), Text( '51°', style: const TextStyle().copyWith( color: Colors.grey, fontSize: 16, ), ), ], ), ), ); } }
0
mirrored_repositories/Weather/lib/model
mirrored_repositories/Weather/lib/model/ui/f_circular_progress.dart
import 'package:fever/model/colors.dart'; import 'package:flutter/material.dart'; class FCircularProgress extends StatelessWidget { final double width; final double height; final double stokeWidth; const FCircularProgress( {super.key, this.width = 40.0, this.height = 40.0, this.stokeWidth = 2.0}); @override Widget build(BuildContext context) { return SizedBox( width: width, height: height, child: CircularProgressIndicator( valueColor: const AlwaysStoppedAnimation<Color>(Colors.white), backgroundColor: FColors.blue2, strokeWidth: stokeWidth, )); //return Image.asset('assets/images/loading.gif', width: width, height: height,); } }
0
mirrored_repositories/Weather/lib/model
mirrored_repositories/Weather/lib/model/l10n/l10n.dart
import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; class Localizationes { Localizationes(this.locale); final Locale locale; static Localizationes? of(BuildContext context) { return Localizations.of<Localizationes>(context, Localizationes); } static const LocalizationesDelegete delegate = LocalizationesDelegete(); static final Map<String, Map<String, String>> _localizedValues = { 'en': { 'Today': 'Today', 'SelectCityTitle': 'Select a city', }, 'es': { 'Today': 'Hoy', 'SelectCityTitle': 'Selecciona una ciudad', }, }; String get today { return _localizedValues[locale.languageCode]!['Today'] ?? ''; } String get selectCityTitle { return _localizedValues[locale.languageCode]!['SelectCityTitle'] ?? ''; } } class LocalizationesDelegete extends LocalizationsDelegate<Localizationes> { const LocalizationesDelegete(); @override bool isSupported(Locale locale) => ['en', 'es'].contains(locale.languageCode); @override Future<Localizationes> load(Locale locale) { return SynchronousFuture<Localizationes>(Localizationes(locale)); } @override bool shouldReload(LocalizationesDelegete old) => false; }
0
mirrored_repositories/Weather/lib/controller
mirrored_repositories/Weather/lib/controller/home/home_controller.dart
import 'package:fever/model/citys/citys.dart'; import 'package:fever/model/climate.dart'; import 'package:fever/model/common.dart'; import 'package:fever/model/constants.dart'; import 'package:fever/model/l10n/l10n.dart'; import 'package:fever/model/network/network.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; class HomeController extends GetxController { String _latitud = '19.761461'; String _longitud = '-99.065344'; String _cityName = ''; String _citySelect = ''; String _image = 'https://img.icons8.com/fluency/240/null/sun.png'; String _grados = '0°'; String _minGrados = '0°'; String _maxGrados = '0°'; String _lluvia = '0'; String _viento = '0'; String _humedad = '0'; String _selectCityTitle = ''; List<Citys> _citys = []; Climate? _climate; bool _isLoading = true; bool get isLoading => _isLoading; String get cityName => _cityName; String get image => _image; String get grados => _grados; String get minGrados => _minGrados; String get maxGrados => _maxGrados; String get viento => _viento; String get lluvia => _lluvia; String get humedad => _humedad; @override void onInit() { // TODO: implement onInit _initialLabel(); _getCitys(); super.onInit(); } void _getCitys() async { Network response = Network(); _citys = await response.getCitys(); _isLoading = false; update(); if (_citys.isNotEmpty) { Citys initial = _citys.first; _cityName = initial.display; _citySelect = initial.cityName; _latitud = initial.lat.toString(); _longitud = initial.long.toString(); } _getClime(); } void _getClime() async { _isLoading = true; update(); Network response = Network(); _climate = await response.getDataClime( params: { 'q': _citySelect, 'appid': Id.appId, }, ); if (_climate != null) { _image = Common().selectImageUrl(_climate!.weather.first.main); _grados = '${(_climate!.main.temp - 273.15).round()}°'; _minGrados = '${(_climate!.main.tempMin - 273.15).round()}°'; _maxGrados = '${(_climate!.main.tempMax - 273.15).round()}°'; _humedad = '${_climate!.main.humidity} %'; _viento = '${_climate!.wind.speed}'; _lluvia = '${(_climate!.main.pressure / 10).round()}'; } _isLoading = false; update(); } void getCitySelect() async { Get.dialog( SimpleDialog( title: Text(_selectCityTitle), children: _buildOptions(), ), ); } List<Widget> _buildOptions() { List<Widget> list = []; for (var element in _citys) { list.add(SimpleDialogOption( onPressed: () { _latitud = element.lat.toString(); _longitud = element.long.toString(); _cityName = element.display; _citySelect = element.cityName; update(); Navigator.of(Get.context!).pop(); _getClime(); }, child: Text(element.display), )); } return list; } void _initialLabel() { String a = Localizationes.of(Get.context!)!.today; _selectCityTitle = Localizationes.of(Get.context!)!.selectCityTitle; } }
0
mirrored_repositories/Weather/lib/controller
mirrored_repositories/Weather/lib/controller/splash/splash_controller.dart
import 'package:get/get.dart'; class SplashController extends GetxController { @override void onReady() { // TODO: implement onReady Future.delayed( const Duration(seconds: 2), () { Get.offAllNamed('/home'); }, ); super.onReady(); } }
0
mirrored_repositories/Weather
mirrored_repositories/Weather/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:fever/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/art_store
mirrored_repositories/art_store/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'package:art_store/localizations.dart'; import 'package:art_store/services/i_database_service.dart'; import 'package:art_store/services/sqlite_database_service.dart'; import 'package:art_store/widgets/main_screen.dart'; import 'package:art_store/widgets/shopping_cart_screen/shopping_cart_screen_store.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); final sqliteDatabaseService = SQLiteDatabaseService(); await sqliteDatabaseService.initialize(); await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); runApp( Provider<IDatabaseService>.value( value: sqliteDatabaseService, child: MyApp(), ), ); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return Provider( create: (_) => ShoppingCartScreenStore(), lazy: false, child: MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( appBarTheme: AppBarTheme( color: Colors.white, iconTheme: IconThemeData( color: Colors.black, ), actionsIconTheme: IconThemeData( color: Colors.black, ), ), fontFamily: GoogleFonts.rubik().fontFamily, ), localizationsDelegates: [ const AppLocalizationsDelegate(), GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: AppLocalizationsDelegate.supportedLocals, home: MainScreen(), ), ); } }
0
mirrored_repositories/art_store
mirrored_repositories/art_store/lib/localizations.dart
import 'dart:async'; import 'package:flutter/material.dart'; /// This class is generated by the flappy_translator package /// Please do not change anything manually in this file, instead re-generate it when changes are available class AppLocalizations { static String get bottomNavigationBarMenuHome => _getText('bottomNavigationBarMenuHome'); static String get bottomNavigationBarMenuCart => _getText('bottomNavigationBarMenuCart'); static String get appBarHeadlineArt => _getText('appBarHeadlineArt'); static String get appBarHeadlineStore => _getText('appBarHeadlineStore'); static String get productDetailScreenAddToBasketButton => _getText('productDetailScreenAddToBasketButton'); static String get shoppingCartScreenEmptyCartText => _getText('shoppingCartScreenEmptyCartText'); static String get shoppingCartScreenTotal => _getText('shoppingCartScreenTotal'); static String get shoppingCartButtonCheckout => _getText('shoppingCartButtonCheckout'); static String get shoppingCartButtonCheckoutOK => _getText('shoppingCartButtonCheckoutOK'); static String get shoppingCartButtonCheckoutContent => _getText('shoppingCartButtonCheckoutContent'); static String get shoppingCartButtonCheckoutTitle => _getText('shoppingCartButtonCheckoutTitle'); static String get adaptiveDialogErrorPopupTitle => _getText('adaptiveDialogErrorPopupTitle'); static String get adaptiveDialogErrorPopupContent => _getText('adaptiveDialogErrorPopupContent'); static String get adaptiveDialogErrorPopupButtonLabel => _getText('adaptiveDialogErrorPopupButtonLabel'); static Map<String, String> _localizedValues; static Map<String, String> _enValues = { 'bottomNavigationBarMenuHome': 'Home', 'bottomNavigationBarMenuCart': 'Cart', 'appBarHeadlineArt': 'Art', 'appBarHeadlineStore': 'Store', 'productDetailScreenAddToBasketButton': 'Add to basket', 'shoppingCartScreenEmptyCartText': 'Your cart is empty.', 'shoppingCartScreenTotal': 'Total:', 'shoppingCartButtonCheckout': 'Checkout', 'shoppingCartButtonCheckoutOK': 'Ok', 'shoppingCartButtonCheckoutContent': 'Congratualtions! We have received your order.', 'shoppingCartButtonCheckoutTitle': 'Oder Confirmation', 'adaptiveDialogErrorPopupTitle': 'Error', 'adaptiveDialogErrorPopupContent': 'Something went wrong. Please try again. ', 'adaptiveDialogErrorPopupButtonLabel': 'Try Again', }; static Map<String, String> _deValues = { 'bottomNavigationBarMenuHome': 'Startseite', 'bottomNavigationBarMenuCart': 'Warenkorb', 'appBarHeadlineArt': 'Art', 'appBarHeadlineStore': 'Store', 'productDetailScreenAddToBasketButton': 'Zum Warenkorb hinzufügen', 'shoppingCartScreenEmptyCartText': 'Dein Warenkorb ist leer.', 'shoppingCartScreenTotal': 'Summe:', 'shoppingCartButtonCheckout': 'Kasse', 'shoppingCartButtonCheckoutOK': 'Ok', 'shoppingCartButtonCheckoutContent': 'Herzlichen Glückwunsch! Wir haben Ihre Bestellung bekommen.', 'shoppingCartButtonCheckoutTitle': 'Bestellbestätigung', 'adaptiveDialogErrorPopupTitle': 'Fehler', 'adaptiveDialogErrorPopupContent': 'Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.', 'adaptiveDialogErrorPopupButtonLabel': 'Wiederholen', }; static Map<String, Map<String, String>> _allValues = { 'en': _enValues, 'de': _deValues, }; AppLocalizations(Locale locale) { _locale = locale; _localizedValues = null; } static Locale _locale; static String _getText(String key) { return _localizedValues[key] ?? '** $key not found'; } static Locale get currentLocale => _locale; static String get currentLanguage => _locale.languageCode; static Future<AppLocalizations> load(Locale locale) async { final translations = AppLocalizations(locale); _localizedValues = _allValues[locale.toString()]; return translations; } } class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> { const AppLocalizationsDelegate(); static final Set<Locale> supportedLocals = { Locale('en'), Locale('de'), }; @override bool isSupported(Locale locale) => supportedLocals.contains(locale); @override Future<AppLocalizations> load(Locale locale) => AppLocalizations.load(locale); @override bool shouldReload(AppLocalizationsDelegate old) => false; }
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/widgets/main_screen.dart
import 'package:flutter/material.dart'; import 'package:art_store/localizations.dart'; import 'package:art_store/widgets/common/app_bar_title.dart'; import 'package:art_store/widgets/home_screen.dart'; import 'package:art_store/widgets/shopping_cart_screen/shopping_cart_screen.dart'; class MainScreen extends StatefulWidget { const MainScreen({Key key}) : super(key: key); @override _MainScreenState createState() => _MainScreenState(); } class _MainScreenState extends State<MainScreen> { int _currentIndex = 0; final List<Widget> _children = [ HomeScreen(), ShoppingCartScreen(), ]; void onTap(int index) { setState(() { _currentIndex = index; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( elevation: 0, centerTitle: true, title: const AppBarTitle(), ), bottomNavigationBar: BottomNavigationBar( backgroundColor: Colors.white, selectedItemColor: Colors.black, currentIndex: _currentIndex, onTap: onTap, elevation: 0, items: [ BottomNavigationBarItem( icon: Icon(Icons.home), title: Text(AppLocalizations.bottomNavigationBarMenuHome), ), BottomNavigationBarItem( icon: Icon(Icons.shopping_cart), title: Text(AppLocalizations.bottomNavigationBarMenuCart), ), ], ), body: _children[_currentIndex], ); } }
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/widgets/teaser.dart
import 'package:flutter/material.dart'; class Teaser extends StatelessWidget { static const _borderRadius = 10.0; static const _padding = 8.0; final String assetPath; final String title; final String author; final Function onTap; final int id; const Teaser({ Key key, @required this.assetPath, @required this.title, @required this.author, @required this.onTap, @required this.id, }) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: onTap, child: Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(_borderRadius), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(_borderRadius), topRight: Radius.circular(_borderRadius), ), child: Hero( tag: id, child: Image.asset( assetPath, fit: BoxFit.cover, ), ), ), Padding( padding: const EdgeInsets.only(top: _padding, bottom: 4, left: _padding), child: Text( title, style: const TextStyle(fontWeight: FontWeight.bold), ), ), Padding( padding: const EdgeInsets.only(bottom: _padding, left: _padding), child: Text( author, style: const TextStyle(fontSize: 12), ), ), ], ), ), ); } }
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/widgets/home_screen.dart
import 'package:art_store/localizations.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:provider/provider.dart'; import 'package:art_store/models/product.dart'; import 'package:art_store/services/i_database_service.dart'; import 'package:art_store/widgets/common/adaptive_dialog.dart'; import 'package:art_store/widgets/product_detail_screen/product_detail_screen.dart'; import 'package:art_store/widgets/teaser.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({Key key}) : super(key: key); @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { IDatabaseService databaseService; Future<List<Product>> _productFuture; bool hasResolvedDependencies = false; @override void didChangeDependencies() { super.didChangeDependencies(); if (!hasResolvedDependencies) { databaseService = Provider.of<IDatabaseService>(context); _productFuture = databaseService.getAllProducts(); hasResolvedDependencies = true; } } @override Widget build(BuildContext context) { return FutureBuilder( future: _productFuture, builder: ( context, AsyncSnapshot<List<Product>> snapshot, ) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { return StaggeredGridView.countBuilder( crossAxisCount: 2, itemCount: snapshot.data.length, itemBuilder: (BuildContext context, int index) => Teaser( id: snapshot.data[index].id, onTap: () => Navigator.of(context).push( MaterialPageRoute( builder: (ctx) => ProductDetailScreen(product: snapshot.data[index]), ), ), title: snapshot.data[index].name, author: snapshot.data[index].author, assetPath: snapshot.data[index].assetPath, ), staggeredTileBuilder: (int index) => StaggeredTile.fit(1), mainAxisSpacing: 4.0, crossAxisSpacing: 4.0, ); } else if (snapshot.connectionState == ConnectionState.done && (snapshot.hasError || snapshot.data == null)) { _showErrorPopup(); return Container(); } return Center( child: CircularProgressIndicator(), ); }, ); } Future<void> _showErrorPopup() async { await Future.delayed(Duration(milliseconds: 1)); showAdaptiveDialog( context: context, adaptiveDialog: AdaptiveDialog( title: AppLocalizations.adaptiveDialogErrorPopupTitle, content: AppLocalizations.adaptiveDialogErrorPopupContent, actionLabel: AppLocalizations.adaptiveDialogErrorPopupButtonLabel, onPressed: () { Navigator.of(context).pop(); setState(() { _productFuture = databaseService.getAllProducts(); }); }, ), ); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/shopping_cart_screen/shopping_cart_screen_store.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'shopping_cart_screen_store.dart'; // ************************************************************************** // StoreGenerator // ************************************************************************** // ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic mixin _$ShoppingCartScreenStore on _ShoppingCartScreenStore, Store { Computed<double> _$sumTotalPriceComputed; @override double get sumTotalPrice => (_$sumTotalPriceComputed ??= Computed<double>(() => super.sumTotalPrice)) .value; final _$_ShoppingCartScreenStoreActionController = ActionController(name: '_ShoppingCartScreenStore'); @override void addProductToCart(Product product) { final _$actionInfo = _$_ShoppingCartScreenStoreActionController.startAction(); try { return super.addProductToCart(product); } finally { _$_ShoppingCartScreenStoreActionController.endAction(_$actionInfo); } } @override void deleteProductFromCart(Product product) { final _$actionInfo = _$_ShoppingCartScreenStoreActionController.startAction(); try { return super.deleteProductFromCart(product); } finally { _$_ShoppingCartScreenStoreActionController.endAction(_$actionInfo); } } @override void clearShoppingCart() { final _$actionInfo = _$_ShoppingCartScreenStoreActionController.startAction(); try { return super.clearShoppingCart(); } finally { _$_ShoppingCartScreenStoreActionController.endAction(_$actionInfo); } } @override void _removeCartItem(CartItem cartItem) { final _$actionInfo = _$_ShoppingCartScreenStoreActionController.startAction(); try { return super._removeCartItem(cartItem); } finally { _$_ShoppingCartScreenStoreActionController.endAction(_$actionInfo); } } @override String toString() { final string = 'sumTotalPrice: ${sumTotalPrice.toString()}'; return '{$string}'; } } mixin _$CartItem on _CartItem, Store { Computed<int> _$quantityComputed; @override int get quantity => (_$quantityComputed ??= Computed<int>(() => super.quantity)).value; Computed<double> _$subTotalComputed; @override double get subTotal => (_$subTotalComputed ??= Computed<double>(() => super.subTotal)).value; final _$_quantityAtom = Atom(name: '_CartItem._quantity'); @override int get _quantity { _$_quantityAtom.context.enforceReadPolicy(_$_quantityAtom); _$_quantityAtom.reportObserved(); return super._quantity; } @override set _quantity(int value) { _$_quantityAtom.context.conditionallyRunInAction(() { super._quantity = value; _$_quantityAtom.reportChanged(); }, _$_quantityAtom, name: '${_$_quantityAtom.name}_set'); } final _$_CartItemActionController = ActionController(name: '_CartItem'); @override void incrementQuantity() { final _$actionInfo = _$_CartItemActionController.startAction(); try { return super.incrementQuantity(); } finally { _$_CartItemActionController.endAction(_$actionInfo); } } @override void decrementQuantity() { final _$actionInfo = _$_CartItemActionController.startAction(); try { return super.decrementQuantity(); } finally { _$_CartItemActionController.endAction(_$actionInfo); } } @override String toString() { final string = 'quantity: ${quantity.toString()},subTotal: ${subTotal.toString()}'; return '{$string}'; } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/shopping_cart_screen/shopping_cart_screen.dart
import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:provider/provider.dart'; import 'package:art_store/config/constants.dart'; import 'package:art_store/localizations.dart'; import 'package:art_store/widgets/common/adaptive_dialog.dart'; import 'package:art_store/widgets/common/shopping_cart_button.dart'; import 'package:art_store/widgets/common/stepper_count.dart'; import 'package:art_store/widgets/shopping_cart_screen/shopping_cart_screen_store.dart'; class ShoppingCartScreen extends StatelessWidget { static const double _indent = 32; const ShoppingCartScreen({Key key}) : super(key: key); @override Widget build(BuildContext context) { final store = Provider.of<ShoppingCartScreenStore>(context, listen: false); return Scaffold( body: SafeArea( child: Observer( builder: (_) => store.cartItems.isEmpty ? Center( child: Text(AppLocalizations.shoppingCartScreenEmptyCartText), ) : Column( children: <Widget>[ Expanded( child: ListView.builder( itemCount: store.cartItems.length, itemBuilder: (context, index) => LayoutBuilder( builder: (context, constraints) { final cartItem = store.cartItems[index]; final product = cartItem.product; return Dismissible( key: Key('$product.id'), direction: DismissDirection.endToStart, onDismissed: (_) => store.deleteProductFromCart(product), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4), child: Row( mainAxisSize: MainAxisSize.max, children: <Widget>[ Container( width: constraints.maxWidth * 0.3, height: constraints.maxWidth * 0.4, child: Image.asset( product.assetPath, fit: BoxFit.cover, ), ), Expanded( child: Padding( padding: EdgeInsets.only( left: constraints.maxWidth * 0.05, right: constraints.maxWidth * 0.05, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( product.name, style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 16, ), ), Text(product.author), ], ), ), ), Observer( builder: (_) => Column( children: <Widget>[ Text( currencyFormatter.format(cartItem.subTotal), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 18, ), ), StepperCount( onIncrement: cartItem.incrementQuantity, onDecrement: cartItem.decrementQuantity, quantity: cartItem.quantity, width: constraints.maxWidth * 0.25, ), ], ), ), ], ), ), ); }, ), ), ), Divider( indent: _indent, endIndent: _indent, color: Colors.black45, ), Padding( padding: const EdgeInsets.symmetric( horizontal: _indent, vertical: 16, ), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(bottom: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Text( AppLocalizations.shoppingCartScreenTotal, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), ), Observer( builder: (_) => Text( currencyFormatter.format(store.sumTotalPrice), style: TextStyle( fontWeight: FontWeight.bold, fontSize: 24, ), ), ), ], ), ), LayoutBuilder( builder: (_, constraints) => ShoppingCartButton( width: constraints.maxWidth * 0.75, onPressed: () => showAdaptiveDialog( context: context, adaptiveDialog: AdaptiveDialog( title: AppLocalizations.shoppingCartButtonCheckoutTitle, content: AppLocalizations.shoppingCartButtonCheckoutContent, actionLabel: AppLocalizations.shoppingCartButtonCheckoutOK, onPressed: () { store.clearShoppingCart(); Navigator.of(context).pop(); }, ), barrierDismissible: false, ), label: AppLocalizations.shoppingCartButtonCheckout.toUpperCase(), ), ), ], ), ) ], ), ), ), ); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/shopping_cart_screen/shopping_cart_screen_store.dart
import 'package:meta/meta.dart'; import 'package:mobx/mobx.dart'; import 'package:art_store/models/product.dart'; part 'shopping_cart_screen_store.g.dart'; class ShoppingCartScreenStore = _ShoppingCartScreenStore with _$ShoppingCartScreenStore; abstract class _ShoppingCartScreenStore with Store { final ObservableList<CartItem> _cartItems = ObservableList<CartItem>(); ObservableList<CartItem> get cartItems => _cartItems; @computed double get sumTotalPrice { double total = 0; for (CartItem cartItem in _cartItems) { total += cartItem.subTotal; } return total; } // double get sumTotalPrice => _cartItems.map((item) => item.subTotal).reduce((a, b) => a + b); bool isProductInCart(Product product) => cartItemWithProduct(product) != null; @action void addProductToCart(Product product) { final item = cartItemWithProduct(product); if (item == null) { _cartItems.add( CartItem( product: product, onRemoveItem: _removeCartItem, ), ); } else { item.incrementQuantity(); } } @action void deleteProductFromCart(Product product) => _cartItems.removeWhere((item) => item.product.id == product.id); @action void clearShoppingCart() => _cartItems.clear(); @action void _removeCartItem(CartItem cartItem) => _cartItems.remove(cartItem); CartItem cartItemWithProduct(Product product) => _cartItems.firstWhere( (item) => item.product.id == product.id, orElse: () => null, ); } class CartItem = _CartItem with _$CartItem; abstract class _CartItem with Store { final Product product; final void Function(CartItem) onRemoveItem; _CartItem({ @required this.product, @required this.onRemoveItem, }); @observable int _quantity = 1; @computed int get quantity => _quantity; @computed double get subTotal => product.price * _quantity; @action void incrementQuantity() => _quantity++; @action void decrementQuantity() { _quantity--; if (quantity <= 0) { onRemoveItem(this); } } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/product_detail_screen/star_rating.dart
import 'package:flutter/material.dart'; import 'package:art_store/config/app_colors.dart'; class StarRating extends StatelessWidget { final double productRating; const StarRating({Key key, @required this.productRating}) : super(key: key); @override Widget build(BuildContext context) { return Row( mainAxisSize: MainAxisSize.min, children: List.generate( 5, (index) => Icon( index < productRating ? Icons.star : Icons.star_border, color: AppColors.orange, ), ), ); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/product_detail_screen/animated_star_rating.dart
import 'package:art_store/widgets/product_detail_screen/star_rating.dart'; import 'package:flutter/material.dart'; class AnimatedStarRating extends StatefulWidget { final double prodcutRating; AnimatedStarRating({ Key key, @required this.prodcutRating, }) : super(key: key); @override _AnimatedStarRatingState createState() => _AnimatedStarRatingState(); } class _AnimatedStarRatingState extends State<AnimatedStarRating> with SingleTickerProviderStateMixin { AnimationController _controller; double currentValue = 0; @override void initState() { super.initState(); _controller = AnimationController(vsync: this); } @override Widget build(BuildContext context) { _controller.duration = const Duration(milliseconds: 500); _controller.reset(); Animation _animation = Tween<double>(begin: currentValue, end: widget.prodcutRating).animate(_controller); _animation.addStatusListener((status) { if (status == AnimationStatus.completed) { currentValue = widget.prodcutRating; } }); _controller.forward(); return AnimatedBuilder( animation: _animation, builder: (_, __) => StarRating( productRating: _animation.value, ), ); } @override void dispose() { _controller.dispose(); super.dispose(); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/product_detail_screen/zoom_product.dart
import 'package:art_store/models/product.dart'; import 'package:flutter/material.dart'; import 'package:vector_math/vector_math_64.dart' show Vector3; class ZoomProduct extends StatefulWidget { final Product product; final BoxConstraints constraints; ZoomProduct({Key key, @required this.product, @required this.constraints}) : super(key: key); @override _ZoomProductState createState() => _ZoomProductState(); } class _ZoomProductState extends State<ZoomProduct> { static const double minScale = 0.7; static const double maxScale = 4.0; double _scale = 1.0; double _previousScale = 1.0; @override Widget build(BuildContext context) { return Container( child: ClipRRect( child: Hero( tag: widget.product.id, child: GestureDetector( onScaleStart: (ScaleStartDetails details) { setState(() => _previousScale = _scale); }, onScaleUpdate: (ScaleUpdateDetails details) { setState(() { _scale = _previousScale * details.scale; _scale = _scale.clamp(minScale, maxScale); }); }, onScaleEnd: (ScaleEndDetails details) { setState(() => _previousScale = 1.0); }, child: Transform( alignment: FractionalOffset.center, transform: Matrix4.diagonal3(Vector3(_scale, _scale, _scale)), child: Image.asset( widget.product.assetPath, fit: BoxFit.fitHeight, width: widget.constraints.maxWidth, height: widget.constraints.maxHeight * 0.6, ), ), ), ), ), ); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/product_detail_screen/product_detail_screen.dart
import 'package:art_store/widgets/product_detail_screen/zoom_product.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:provider/provider.dart'; import 'package:art_store/config/constants.dart'; import 'package:art_store/localizations.dart'; import 'package:art_store/models/product.dart'; import 'package:art_store/widgets/common/app_bar_title.dart'; import 'package:art_store/widgets/common/shopping_cart_button.dart'; import 'package:art_store/widgets/common/stepper_count.dart'; import 'package:art_store/widgets/product_detail_screen/star_rating.dart'; import 'package:art_store/widgets/product_detail_screen/animated_star_rating.dart'; import 'package:art_store/widgets/shopping_cart_screen/shopping_cart_screen_store.dart'; class ProductDetailScreen extends StatelessWidget { final Product product; const ProductDetailScreen({ Key key, @required this.product, }) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const AppBarTitle(), centerTitle: true, ), body: SafeArea( child: LayoutBuilder( builder: (context, constraints) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ ZoomProduct( product: product, constraints: constraints, ), Padding( padding: const EdgeInsets.only(top: 16.0, left: 16), child: _Stars( rating: product.rating, ), ), Row( crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: TextBaseline.alphabetic, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 16.0, top: 8), child: Text( product.name, style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 25, ), ), ), Padding( padding: const EdgeInsets.only(right: 16.0, top: 8), child: Text( currencyFormatter.format(product.price), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 25, ), ), ), ], ), Padding( padding: const EdgeInsets.only(left: 16.0, top: 8), child: Text( product.author, style: const TextStyle(fontSize: 14), ), ), Expanded( child: Align( alignment: Alignment.bottomCenter, child: _BottomBar( product: product, width: constraints.maxWidth * 0.75, store: Provider.of<ShoppingCartScreenStore>(context, listen: false), ), ), ) ], ), ), ), ); } } class _BottomBar extends StatelessWidget { final Product product; final double width; final ShoppingCartScreenStore store; const _BottomBar({ @required this.product, @required this.width, @required this.store, Key key, }) : super(key: key); @override Widget build(BuildContext context) { return Observer( builder: (_) => !store.isProductInCart(product) ? ShoppingCartButton( label: AppLocalizations.productDetailScreenAddToBasketButton.toUpperCase(), width: width, onPressed: () => store.addProductToCart(product), ) : StepperCount( width: width, quantity: store.cartItemWithProduct(product).quantity, onIncrement: store.cartItemWithProduct(product).incrementQuantity, onDecrement: store.cartItemWithProduct(product).decrementQuantity, ), ); } } class _Stars extends StatefulWidget { final double rating; _Stars({Key key, @required this.rating}) : super(key: key); @override __StarsState createState() => __StarsState(); } class __StarsState extends State<_Stars> { bool _isDelayDone = false; @override void initState() { super.initState(); Future.delayed(Duration(milliseconds: 600)).then((_) => setState(() => _isDelayDone = true)); } @override Widget build(BuildContext context) { return _isDelayDone ? AnimatedStarRating(prodcutRating: widget.rating) : StarRating(productRating: 0); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/common/adaptive_dialog.dart
import 'dart:io' show Platform; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class AdaptiveDialog extends StatelessWidget { final String title; final String content; final String actionLabel; final void Function() onPressed; const AdaptiveDialog({ Key key, @required this.title, @required this.content, @required this.onPressed, @required this.actionLabel, }) : super(key: key); @override Widget build(BuildContext context) { return Platform.isIOS ? CupertinoAlertDialog( title: Text(title), content: Text(content), actions: <Widget>[ CupertinoButton( onPressed: onPressed, child: Text(actionLabel), ) ], ) : AlertDialog( title: Text(title), content: Text(content), actions: <Widget>[ FlatButton( onPressed: onPressed, child: Text(actionLabel), ) ], ); } } showAdaptiveDialog({ @required BuildContext context, @required AdaptiveDialog adaptiveDialog, bool barrierDismissible = true, }) => showDialog( context: context, builder: (_) => adaptiveDialog, barrierDismissible: barrierDismissible, );
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/common/shopping_cart_button.dart
import 'package:flutter/material.dart'; class ShoppingCartButton extends StatelessWidget { final double width; final Function onPressed; final String label; const ShoppingCartButton({ Key key, @required this.width, @required this.onPressed, @required this.label, }) : super(key: key); @override Widget build(BuildContext context) { return Container( width: width, child: ButtonTheme( height: 50, child: Padding( padding: const EdgeInsets.only(bottom: 8.0), child: RaisedButton( elevation: 0, color: Colors.black, child: Text( label, style: const TextStyle( color: Colors.white, fontWeight: FontWeight.bold, ), ), onPressed: onPressed, ), ), ), ); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/common/app_bar_title.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:art_store/localizations.dart'; class AppBarTitle extends StatelessWidget { const AppBarTitle({Key key}) : super(key: key); @override Widget build(BuildContext context) { final appBarHeight = AppBar().preferredSize.height; return Text.rich( TextSpan( text: AppLocalizations.appBarHeadlineArt, style: TextStyle( fontFamily: 'Arthure', color: Colors.black, fontSize: appBarHeight * 0.85, ), children: <TextSpan>[ TextSpan( text: AppLocalizations.appBarHeadlineStore, style: TextStyle( fontFamily: GoogleFonts.rubik().fontFamily, fontSize: appBarHeight * 0.30, color: Colors.black, ), ), ], ), maxLines: 1, ); } }
0
mirrored_repositories/art_store/lib/widgets
mirrored_repositories/art_store/lib/widgets/common/stepper_count.dart
import 'package:flutter/material.dart'; import 'package:art_store/config/app_colors.dart'; class StepperCount extends StatelessWidget { final int quantity; final double width; final void Function() onDecrement; final void Function() onIncrement; StepperCount({ Key key, @required this.quantity, this.width = 75, @required this.onDecrement, @required this.onIncrement, }) : super(key: key); @override Widget build(BuildContext context) { return Container( width: width, child: FittedBox( fit: BoxFit.fitWidth, child: Row( children: <Widget>[ IconButton( padding: EdgeInsets.all(0), icon: const Icon( Icons.remove, size: 16, ), onPressed: onDecrement, ), Container( width: 30, height: 30, decoration: const BoxDecoration( shape: BoxShape.circle, color: AppColors.orange, ), child: Center( child: Text( quantity.toString(), style: const TextStyle( fontWeight: FontWeight.bold, color: Colors.white, ), ), ), ), IconButton( padding: const EdgeInsets.all(0), icon: const Icon( Icons.add, size: 16, ), onPressed: onIncrement, ), ], ), ), ); } }
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/models/product.dart
import 'package:flutter/material.dart'; class Product { final int id; final String author; final String name; final double price; final double rating; final String assetPath; Product({ @required this.author, @required this.name, @required this.id, @required this.price, @required this.rating, }) : assetPath = 'assets/images/$id.jpeg'; factory Product.fromJson(Map<String, dynamic> json) => Product( id: json['id'], name: json['name'], author: json['author'], price: json['price'].toDouble(), rating: json['rating'].toDouble(), ); Map<String, dynamic> toJson() => { 'id': id, 'name': name, 'author': author, 'price': price, 'rating': rating, }; @override String toString() => toJson().toString(); }
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/config/app_colors.dart
import 'package:flutter/material.dart'; class AppColors { static const Color orange = Color(0xffff7805); }
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/config/constants.dart
import 'package:intl/intl.dart'; import 'package:art_store/localizations.dart'; final currencyFormatter = NumberFormat.currency( locale: AppLocalizations.currentLocale.toString(), symbol: '€', decimalDigits: 2, );
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/services/i_database_service.dart
import 'package:art_store/models/product.dart'; abstract class IDatabaseService { Future<void> initialize(); Future<List<Product>> getAllProducts(); }
0
mirrored_repositories/art_store/lib
mirrored_repositories/art_store/lib/services/sqlite_database_service.dart
import 'dart:io'; import 'package:flutter/services.dart' show ByteData, rootBundle; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; import 'package:art_store/models/product.dart'; import 'package:art_store/services/i_database_service.dart'; import 'package:sqflite/sqflite.dart' as sql; class SQLiteDatabaseService implements IDatabaseService { static const String _allProductsQuery = 'SELECT * from Products'; sql.Database _database; @override Future<void> initialize() async { const databaseFilename = 'products.db'; Directory appDir = await getApplicationDocumentsDirectory(); String dbPath = join(appDir.path, databaseFilename); // if db does not exist in user's documents dir, then copy from assets if (FileSystemEntity.typeSync(dbPath) == FileSystemEntityType.notFound) { ByteData data = await rootBundle.load('assets/$databaseFilename'); _writeToFile(data, dbPath); } // open the database _database = await sql.openReadOnlyDatabase(dbPath); assert(_database != null); } // taken from https://stackoverflow.com/a/50121777 void _writeToFile(ByteData data, String path) { final buffer = data.buffer; return File(path).writeAsBytesSync(buffer.asUint8List(data.offsetInBytes, data.lengthInBytes)); } @override Future<List<Product>> getAllProducts() async => await _getProductsWithQuery(_allProductsQuery); Future<List<Product>> _getProductsWithQuery(String query) async { List<Product> products = []; try { final List<Map> results = await _database.rawQuery(query); for (Map map in results) { Product product = Product.fromJson(map); products.add(product); } } catch (e) { print(e); } return products; } }
0
mirrored_repositories/art_store
mirrored_repositories/art_store/test/shopping_cart_test.dart
void main() {}
0
mirrored_repositories/art_store/test
mirrored_repositories/art_store/test/models/product_test.dart
import 'package:flutter_test/flutter_test.dart'; import 'package:art_store/models/product.dart'; main() { test('fomJson', () { final jsonMap = { 'id': 1, 'name': 'Now or Never', 'author': 'Daria Shevtsova', 'price': 199.99, 'rating': 3, }; final product = Product.fromJson(jsonMap); expect(product.id, 1); expect(product.name, 'Now or Never'); expect(product.author, 'Daria Shevtsova'); expect(product.price, 199.99); expect(product.rating, 3); }); test('fomJson', () { final jsonMap = { 'id': 1, 'name': 'Now or Never', 'author': 'Daria Shevtsova', 'price': 199.99, 'rating': 3, }; final product = Product( id: 1, name: 'Now or Never', author: 'Daria Shevtsova', price: 199.99, rating: 3, ); final convertedJsonMap = product.toJson(); expect(convertedJsonMap, jsonMap); }); }
0
mirrored_repositories/International_News_App
mirrored_repositories/International_News_App/lib/main.dart
import 'package:flutter/material.dart'; import 'package:international_news_app/View/splash_screnn.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData(primarySwatch: Colors.blue), home: Splash_Screen(), ); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/repository/news_repo.dart
import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:international_news_app/View/Models/catagory_newsmodel.dart'; import 'package:international_news_app/View/Models/news_chanel_headlines_model.dart'; class newsrespository { Future<NewsChanelHeadlinesModel> fetchnewschanelheadlinesAPi( String chanelname) async { String url = 'https://newsapi.org/v2/top-headlines?sources=${chanelname}&apiKey=e371be4c11fd4844a6216ee31527b318'; final response = await http.get(Uri.parse(url)); if (response.statusCode == 200) { final body = jsonDecode(response.body); return NewsChanelHeadlinesModel.fromJson(body); } throw Exception("Failed to fetch data: ${response.statusCode}"); } Future<CatagoryNewsModel> fetchCatagoryNewsAPi(String Catagory) async { String url = 'https://newsapi.org/v2/everything?q=${Catagory}&apiKey=e371be4c11fd4844a6216ee31527b318'; final response = await http.get(Uri.parse(url)); if (response.statusCode == 200) { final body = jsonDecode(response.body); return CatagoryNewsModel.fromJson(body); } throw Exception("Failed to fetch data: ${response.statusCode}"); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/view_model/News_viewModel.dart
import 'package:international_news_app/View/Models/catagory_newsmodel.dart'; import 'package:international_news_app/View/Models/news_chanel_headlines_model.dart'; import 'package:international_news_app/repository/news_repo.dart'; class NewsViewModel { final repo = newsrespository(); Future<NewsChanelHeadlinesModel> fetchnewschanelheadlinesAPi( String chanelname) async { final response = await repo.fetchnewschanelheadlinesAPi(chanelname); return response; } Future<CatagoryNewsModel> fetchCatagoryNewsAPi(String Catagory) async { final response = await repo.fetchCatagoryNewsAPi(Catagory); return response; } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/profile.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/Mywidgets/Listtile.dart'; class User_Profile extends StatefulWidget { const User_Profile({super.key}); @override State<User_Profile> createState() => _User_ProfileState(); } class _User_ProfileState extends State<User_Profile> { @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; return SafeArea( child: Scaffold( body: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: hieght * .03, ), Center( child: Text("Profile Setting", style: GoogleFonts.montserrat( color: Colors.blue.shade700, fontSize: 20, fontWeight: FontWeight.bold)), ), SizedBox( height: hieght * .05, ), Center( child: CircleAvatar( radius: 64, backgroundColor: Colors.blue.shade800, child: const CircleAvatar( radius: 60, backgroundImage: NetworkImage( 'https://images.unsplash.com/photo-1522075469751-3a6694fb2f61?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1480&q=80')), ), ), SizedBox( height: hieght * .03, ), Center( child: Text( "User Admin", style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.bold), ), ), SizedBox( height: hieght * .01, ), const Center(child: Text("[email protected]")), //List Create here SizedBox( height: hieght * .05, ), Text( "Profile", style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.bold), ), SizedBox( height: hieght * .04, ), MyList( title: "Personal Data", icondata: Icon(Icons.person_3_outlined, color: Colors.black.withOpacity(.6))), SizedBox( height: hieght * .04, ), MyList( title: "Language", icondata: Icon(Icons.language_outlined, color: Colors.black.withOpacity(.6))), SizedBox( height: hieght * .04, ), MyList( title: "Notification", icondata: Icon(Icons.notifications_active_outlined, color: Colors.black.withOpacity(.6))), SizedBox( height: hieght * .05, ), Text( "Security", style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.bold), ), SizedBox( height: hieght * .04, ), MyList( title: "Password", icondata: Icon(Icons.lock_outline_rounded, color: Colors.black.withOpacity(.6))), SizedBox( height: hieght * .04, ), MyList( title: "Privacy Policy", icondata: Icon(Icons.privacy_tip_outlined, color: Colors.black.withOpacity(.6))), SizedBox( height: hieght * .04, ), MyList( title: "Log out", icondata: Icon(Icons.logout_outlined, color: Colors.black.withOpacity(.6))), SizedBox( height: hieght * .06, ), ], ), ), ), ), ); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/splash_screnn.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/home.dart'; class Splash_Screen extends StatefulWidget { const Splash_Screen({super.key}); @override State<Splash_Screen> createState() => _Splash_ScreenState(); } class _Splash_ScreenState extends State<Splash_Screen> { @override void initState() { // TODO: implement initState super.initState(); Timer(Duration(seconds: 5), () { Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => HomeScreen(), )); }); } @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; return Scaffold( body: Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( 'images/splash_pic.png', fit: BoxFit.cover, // width: width * .9, height: hieght * .5, ), SizedBox(height: hieght * .04), Text( "TOP HEADLINES", style: GoogleFonts.anton( letterSpacing: .6, color: Colors.grey.shade700, fontSize: 20), ), SizedBox(height: hieght * .04), SpinKitChasingDots( size: 40, color: Colors.blue, ) ], ), ), ); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/save.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/Models/catagory_newsmodel.dart'; import 'package:international_news_app/view_model/News_viewModel.dart'; class Saved_items extends StatefulWidget { const Saved_items({super.key}); @override State<Saved_items> createState() => _Saved_itemsState(); } class _Saved_itemsState extends State<Saved_items> { NewsViewModel newsViewModel = NewsViewModel(); String CatagoryName = "Sports"; @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; return SafeArea( child: Scaffold( appBar: AppBar( title: Text( "Saved News", style: GoogleFonts.montserrat( color: Colors.blue.shade700, fontWeight: FontWeight.bold), ), centerTitle: true, elevation: 0, backgroundColor: Colors.transparent, ), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ SizedBox( height: hieght * .01, ), Expanded( child: FutureBuilder<CatagoryNewsModel>( future: newsViewModel.fetchCatagoryNewsAPi(CatagoryName), builder: (BuildContext context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Container(child: Center(child: Spinkit2)); } else { return ListView.builder( itemCount: snapshot.data!.articles!.length, itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.only(top: 8), child: Container( decoration: BoxDecoration( color: Colors.white, border: Border.all( color: Colors.black.withOpacity(.05)), borderRadius: const BorderRadius.all( Radius.circular(12))), child: Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( imageUrl: snapshot .data!.articles![index].urlToImage .toString(), fit: BoxFit.cover, height: hieght * .18, width: width * .25, placeholder: (context, url) => Container( child: Spinkit2, ), ), ), Expanded( child: Container( padding: const EdgeInsets.all(6), height: hieght * .18, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( snapshot .data!.articles![index].title .toString(), style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.w600), maxLines: 3, overflow: TextOverflow.ellipsis, ), const Spacer(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( snapshot.data!.articles![index] .source!.name .toString(), style: GoogleFonts.montserrat( fontWeight: FontWeight.bold), ), const Icon(Icons.bookmark) ], ) ], ), ), ), ], ), ), ); }, ); } }, ), ) ], ), ), ), ); } final Spinkit2 = const SpinKitThreeBounce( color: Colors.grey, size: 20, ); }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/catagories_naws.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/DetailScreen.dart'; import 'package:international_news_app/View/Models/catagory_newsmodel.dart'; import 'package:international_news_app/view_model/News_viewModel.dart'; import 'package:intl/intl.dart'; class Catagories_News extends StatefulWidget { const Catagories_News({super.key}); @override State<Catagories_News> createState() => _Catagories_NewsState(); } class _Catagories_NewsState extends State<Catagories_News> { NewsViewModel newsViewModel = NewsViewModel(); final format = DateFormat('MMM dd, yyyy'); String CatagoryName = "General"; List<String> CatagoriesList = [ "General", "Enterainment", "Health", "Business", "Technology", "Sports" ]; @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; return SafeArea( child: Scaffold( appBar: AppBar( title: Text( "News Catagories", style: GoogleFonts.montserrat( color: Colors.blue.shade700, fontWeight: FontWeight.bold), ), centerTitle: true, elevation: 0, leading: InkWell( onTap: () { Navigator.pop(context); }, child: Icon( Icons.arrow_back, color: Colors.blue.shade700, ), ), backgroundColor: Colors.transparent, ), body: Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ SizedBox( height: hieght * .01, ), SizedBox( height: 50, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: CatagoriesList.length, itemBuilder: (context, index) { return InkWell( onTap: () { CatagoryName = CatagoriesList[index]; setState(() {}); }, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 07), child: Container( decoration: BoxDecoration( border: CatagoryName == CatagoriesList[index] ? Border.all(color: Colors.transparent) : Border.all(color: Colors.grey.shade300), borderRadius: BorderRadius.circular(20), color: CatagoryName == CatagoriesList[index] ? Colors.blue.shade700 : Colors.transparent), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Center( child: Text( CatagoriesList[index].toString(), style: GoogleFonts.montserrat( color: CatagoryName == CatagoriesList[index] ? Colors.white : Colors.black), )), ), ), ), ); }, ), ), SizedBox(height: hieght * .02), Expanded( child: FutureBuilder<CatagoryNewsModel>( future: newsViewModel.fetchCatagoryNewsAPi(CatagoryName), builder: (BuildContext context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Container(child: Center(child: Spinkit2)); } else { return ListView.builder( itemCount: snapshot.data!.articles!.length, itemBuilder: (context, index) { DateTime dateTime = DateTime.parse(snapshot .data!.articles![index].publishedAt .toString()); return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DetailScreen( DateTime: format.format(dateTime), image: snapshot .data!.articles![index].urlToImage .toString(), author: snapshot .data!.articles![index].author .toString(), newschanel: snapshot.data! .articles![index].source!.name .toString(), title: snapshot .data!.articles![index].title .toString(), description: snapshot .data!.articles![index].content .toString()))); }, child: Padding( padding: const EdgeInsets.only(top: 8), child: Container( decoration: BoxDecoration( color: Colors.white, border: Border.all( color: Colors.black.withOpacity(.05)), borderRadius: const BorderRadius.all(Radius.circular(12))), child: Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( imageUrl: snapshot .data!.articles![index].urlToImage .toString(), fit: BoxFit.cover, height: hieght * .18, width: width * .25, placeholder: (context, url) => Container( child: Spinkit2, ), ), ), Expanded( child: Container( padding: const EdgeInsets.all(6), height: hieght * .18, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( snapshot .data!.articles![index].title .toString(), style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.w600), maxLines: 3, overflow: TextOverflow.ellipsis, ), const Spacer(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( snapshot.data!.articles![index] .source!.name .toString(), style: GoogleFonts.montserrat( fontWeight: FontWeight.bold), ), Text( format.format(dateTime), style: GoogleFonts.montserrat( fontWeight: FontWeight.w600, color: Colors.blue), ), ], ) ], ), ), ), ], ), ), ), ); }, ); } }, ), ) ], ), ), ), ); } final Spinkit2 = const SpinKitThreeBounce( color: Colors.grey, size: 20, ); }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/nav_bar.dart
import 'package:flutter/material.dart'; import 'package:international_news_app/View/News_Homepage.dart'; import 'package:international_news_app/View/profile.dart'; import 'package:international_news_app/View/save.dart'; import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart'; class Bottom_Nav_Bar extends StatefulWidget { const Bottom_Nav_Bar({Key? key}) : super(key: key); @override State<Bottom_Nav_Bar> createState() => _Bottom_Nav_BarState(); } class _Bottom_Nav_BarState extends State<Bottom_Nav_Bar> { final controler = PersistentTabController(initialIndex: 0); List<Widget> buildscreen() { return [ const News_Homepage(), const Saved_items(), const User_Profile(), ]; } List<PersistentBottomNavBarItem> navitem() { return [ PersistentBottomNavBarItem( icon: const Icon(Icons.home), inactiveIcon: const Icon(Icons.home_outlined, color: Colors.black54)), PersistentBottomNavBarItem( icon: const Icon(Icons.bookmark), inactiveIcon: const Icon(Icons.bookmark_border_outlined, color: Colors.black54)), PersistentBottomNavBarItem( icon: const Icon(Icons.person), inactiveIcon: const Icon(Icons.person_outline, color: Colors.black54)), ]; } @override Widget build(BuildContext context) { return PersistentTabView( context, screens: buildscreen(), items: navitem(), backgroundColor: Colors.grey.shade100.withOpacity(.9), controller: controler, decoration: NavBarDecoration( border: Border.all(color: Colors.black.withOpacity(.05)), borderRadius: const BorderRadius.only( topLeft: Radius.circular(20), topRight: Radius.circular(20))), screenTransitionAnimation: const ScreenTransitionAnimation( // Screen transition animation on change of selected tab. animateTabTransition: true, curve: Curves.ease, duration: Duration(milliseconds: 200), ), navBarStyle: NavBarStyle.neumorphic, ); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/signup_screen.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/login_screen.dart'; class Signup_Screen extends StatefulWidget { const Signup_Screen({super.key}); @override State<Signup_Screen> createState() => _Signup_ScreenState(); } class _Signup_ScreenState extends State<Signup_Screen> { bool toggle = true; final _formkey = GlobalKey<FormState>(); @override TextEditingController namecontroller = TextEditingController(); TextEditingController emailcontroller = TextEditingController(); TextEditingController passwordcontroller = TextEditingController(); @override void dispose() { // TODO: implement dispose super.dispose(); namecontroller.dispose(); emailcontroller.dispose(); passwordcontroller.dispose(); } @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; return Scaffold( body: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(height: hieght * .13), Center( child: Text( "Create your account", style: GoogleFonts.montserrat( fontSize: 20, fontWeight: FontWeight.bold), ), ), SizedBox(height: hieght * .05), Form( key: _formkey, child: Column( children: [ TextFormField( controller: namecontroller, decoration: InputDecoration( labelText: "Full Name", prefixIcon: Icon( Icons.person_outline, size: 24, color: Colors.grey.shade600, ), border: const OutlineInputBorder()), validator: (value) { if (value!.isEmpty) { return "Please enter full name"; } else { return null; } }, ), SizedBox( height: hieght * 0.04, ), TextFormField( controller: emailcontroller, decoration: InputDecoration( labelText: "Email", prefixIcon: Icon( Icons.email_outlined, size: 24, color: Colors.grey.shade600, ), border: const OutlineInputBorder() ), validator: (value) { if (value!.isEmpty) { return "Please enter email"; } else { return null; } }, ), SizedBox( height: hieght * 0.04, ), TextFormField( controller: passwordcontroller, obscureText: toggle, decoration: InputDecoration( labelText: "Password", prefixIcon: Icon( Icons.lock_outline, size: 24, color: Colors.grey.shade600, ), suffixIcon: InkWell( onTap: () { setState(() { toggle = !toggle; }); }, child: toggle ? Icon( Icons.visibility_outlined, color: Colors.grey.shade600, ) : Icon( Icons.visibility_off_outlined, color: Colors.grey.shade600, )), border: const OutlineInputBorder() ), validator: (value) { if (value!.isEmpty) { return "Please enter password"; } else { return null; } }, ), ], )), SizedBox( height: hieght * 0.06, ), InkWell( onTap: () { if (_formkey.currentState!.validate()) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => Login_Screen())); } else { return null; } }, child: Container( height: 50, decoration: BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.circular(8)), child: Center( child: Text( "Create Account", style: GoogleFonts.montserrat(color: Colors.white), )), ), ), SizedBox( height: hieght * 0.04, ), Row( // mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Container( height: 1, color: Colors.grey.shade300, ), ), const Text(" or "), Expanded( child: Container( height: 1, color: Colors.grey.shade300, )), ], ), SizedBox(height: hieght * .06), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Already have an account? ", style: GoogleFonts.montserrat(fontSize: 12), ), InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const Login_Screen(), )); }, child: Text( "Login", style: GoogleFonts.montserrat( color: Colors.blue, fontSize: 12, fontWeight: FontWeight.bold), ), ), ], ) ], ), )), ); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/News_Homepage.dart
import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/DetailScreen.dart'; import 'package:international_news_app/View/Models/catagory_newsmodel.dart'; import 'package:international_news_app/View/Models/news_chanel_headlines_model.dart'; import 'package:international_news_app/View/catagories_naws.dart'; import 'package:international_news_app/view_model/News_viewModel.dart'; import 'package:intl/intl.dart'; class News_Homepage extends StatefulWidget { const News_Homepage({super.key}); @override State<News_Homepage> createState() => _News_HomepageState(); } enum filterlist { bbc_news, Arynews, Cnn, aljazeera, independent } class _News_HomepageState extends State<News_Homepage> { NewsViewModel newsViewModel = NewsViewModel(); final format = DateFormat('MMM dd, yyyy'); filterlist? selectedmenu; String name = "bbc-news"; final colorizeColors = [ Colors.black, Colors.white60, ]; @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; return Scaffold( // backgroundColor: Colors.white, appBar: AppBar( backgroundColor: Colors.transparent, elevation: 0, leading: IconButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const Catagories_News(), )); }, icon: Image.asset( "images/category_icon.png", color: Colors.blue.shade700, height: 25, width: 25, )), title: Text( "News", style: GoogleFonts.montserrat( color: Colors.blue.shade700, fontSize: 24, fontWeight: FontWeight.w700), ), centerTitle: true, actions: [ PopupMenuButton<filterlist>( initialValue: selectedmenu, icon: Icon( Icons.more_vert, color: Colors.blue.shade700, ), onSelected: (filterlist item) { if (filterlist.bbc_news.name == item.name) { name = 'bbc-news'; } if (filterlist.Arynews.name == item.name) { name = 'ary-news'; } if (filterlist.Cnn.name == item.name) { name = "cnn"; } if (filterlist.aljazeera.name == item.name) { name = "al-jazeera-english"; } if (filterlist.independent.name == item.name) { name = "independent"; } setState(() {}); }, itemBuilder: (BuildContext context) => <PopupMenuEntry<filterlist>>[ const PopupMenuItem<filterlist>( value: filterlist.bbc_news, child: Text("BBC News")), const PopupMenuItem<filterlist>( value: filterlist.Arynews, child: Text("ARY News")), const PopupMenuItem<filterlist>( value: filterlist.aljazeera, child: Text("AlJazeera News")), const PopupMenuItem<filterlist>( value: filterlist.Cnn, child: Text("CNN News")), const PopupMenuItem<filterlist>( value: filterlist.independent, child: Text("Independent")), ], ), SizedBox(width: width * .01), ], ), body: Padding( padding: const EdgeInsets.only(left: 8, right: 8, bottom: 4), child: ListView( children: [ SizedBox(height: hieght * .04), Text( "Worldwide Breaking News", style: GoogleFonts.montserrat( color: Colors.blue.shade700, fontSize: 20, fontWeight: FontWeight.bold), ), SizedBox(height: hieght * .02), SizedBox( // color: Colors.black, height: hieght * .43, width: width, child: FutureBuilder<NewsChanelHeadlinesModel>( future: newsViewModel.fetchnewschanelheadlinesAPi(name), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center(child: Spinkit2); } else { return ListView.builder( scrollDirection: Axis.horizontal, itemCount: snapshot.data!.articles!.length, itemBuilder: (context, index) { DateTime dateTime = DateTime.parse(snapshot .data!.articles![index].publishedAt .toString()); return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DetailScreen( DateTime: format.format(dateTime), image: snapshot .data!.articles![index].urlToImage .toString(), author: snapshot .data!.articles![index].author .toString(), newschanel: snapshot .data!.articles![index].source!.name .toString(), title: snapshot .data!.articles![index].title .toString(), description: snapshot .data!.articles![index].description .toString()))); }, child: Padding( padding: const EdgeInsets.only(right: 8), child: Container( height: hieght * .4, width: width * .8, decoration: BoxDecoration( border: Border.all( color: Colors.black.withOpacity(.05)), color: Colors.white, borderRadius: BorderRadius.circular(12)), child: Column( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( height: hieght * .26, imageUrl: snapshot .data!.articles![index].urlToImage .toString(), fit: BoxFit.cover, placeholder: (context, url) => Container( child: Spinkit2, ), ), ), Column( children: [ SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: SizedBox( height: hieght * .1, width: width * .8, child: Text( snapshot .data!.articles![index].title .toString(), style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.w600), maxLines: 3, overflow: TextOverflow.ellipsis, ), ), ), SizedBox( height: hieght * .02, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: SizedBox( height: hieght * .03, width: width * .8, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( snapshot.data!.articles![index] .source!.name .toString(), style: GoogleFonts.montserrat( fontWeight: FontWeight.bold), ), Text( format.format(dateTime), style: GoogleFonts.montserrat( fontWeight: FontWeight.w600, color: Colors.blue), ), ], ), ), ), ], ) ], ), ), ), ); }, ); } }, ), ), //General News Horizontal List SizedBox(height: hieght * .04), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "General Updates", style: GoogleFonts.montserrat( color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold), ), Text( "See all", style: GoogleFonts.montserrat( color: Colors.black54, fontSize: 16, fontWeight: FontWeight.w500), ), ], ), SizedBox(height: hieght * .015), SizedBox( // color: Colors.black, height: hieght * .36, width: width, child: FutureBuilder<CatagoryNewsModel>( future: newsViewModel.fetchCatagoryNewsAPi("General"), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center(child: Spinkit2); } else { return ListView.builder( scrollDirection: Axis.horizontal, itemCount: snapshot.data!.articles!.length, itemBuilder: (context, index) { DateTime dateTime = DateTime.parse(snapshot .data!.articles![index].publishedAt .toString()); return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DetailScreen( DateTime: format.format(dateTime), image: snapshot .data!.articles![index].urlToImage .toString(), author: snapshot .data!.articles![index].author .toString(), newschanel: snapshot .data!.articles![index].source!.name .toString(), title: snapshot .data!.articles![index].title .toString(), description: snapshot .data!.articles![index].description .toString()))); }, child: Padding( padding: const EdgeInsets.only(right: 8), child: Container( height: hieght * .3, width: width * .6, decoration: BoxDecoration( border: Border.all( color: Colors.black.withOpacity(.05)), color: Colors.white, borderRadius: BorderRadius.circular(12)), child: Column( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( height: hieght * .2, width: width * .6, imageUrl: snapshot .data!.articles![index].urlToImage .toString(), fit: BoxFit.cover, placeholder: (context, url) => Container( child: Spinkit2, ), ), ), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: SizedBox( height: hieght * .1, width: width * .8, child: Text( snapshot .data!.articles![index].title .toString(), style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.w600), maxLines: 2, overflow: TextOverflow.ellipsis, ), ), ), SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: Text( format.format(dateTime), style: GoogleFonts.montserrat( fontWeight: FontWeight.w600, color: Colors.blue), ), ), ], ) ], ), ), ), ); }, ); } }, ), ), //Sports News Horintal List SizedBox(height: hieght * .04), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "General Updates", style: GoogleFonts.montserrat( color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold), ), Text( "See all", style: GoogleFonts.montserrat( color: Colors.black54, fontSize: 16, fontWeight: FontWeight.w500), ), ], ), SizedBox(height: hieght * .015), SizedBox( height: hieght * .36, width: width, child: FutureBuilder<CatagoryNewsModel>( future: newsViewModel.fetchCatagoryNewsAPi("Sports"), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center(child: Spinkit2); } else { return ListView.builder( scrollDirection: Axis.horizontal, itemCount: snapshot.data!.articles!.length, itemBuilder: (context, index) { DateTime dateTime = DateTime.parse(snapshot .data!.articles![index].publishedAt .toString()); return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DetailScreen( DateTime: format.format(dateTime), image: snapshot .data!.articles![index].urlToImage .toString(), author: snapshot .data!.articles![index].author .toString(), newschanel: snapshot .data!.articles![index].source!.name .toString(), title: snapshot .data!.articles![index].title .toString(), description: snapshot .data!.articles![index].description .toString()))); }, child: Padding( padding: const EdgeInsets.only(right: 8), child: Container( height: hieght * .3, width: width * .6, decoration: BoxDecoration( border: Border.all( color: Colors.black.withOpacity(.05)), color: Colors.white, borderRadius: BorderRadius.circular(12)), child: Column( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( height: hieght * .2, width: width * .6, imageUrl: snapshot .data!.articles![index].urlToImage .toString(), fit: BoxFit.cover, placeholder: (context, url) => Container( child: Spinkit2, ), ), ), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: SizedBox( height: hieght * .1, width: width * .8, child: Text( snapshot .data!.articles![index].title .toString(), style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.w600), maxLines: 2, overflow: TextOverflow.ellipsis, ), ), ), SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: Text( format.format(dateTime), style: GoogleFonts.montserrat( fontWeight: FontWeight.w600, color: Colors.blue), ), ), ], ) ], ), ), ), ); }, ); } }, ), ), //Business News Horintal List SizedBox(height: hieght * .04), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "General Updates", style: GoogleFonts.montserrat( color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold), ), Text( "See all", style: GoogleFonts.montserrat( color: Colors.black54, fontSize: 16, fontWeight: FontWeight.w500), ), ], ), SizedBox(height: hieght * .015), SizedBox( height: hieght * .36, width: width, child: FutureBuilder<CatagoryNewsModel>( future: newsViewModel.fetchCatagoryNewsAPi("Business"), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center(child: Spinkit2); } else { return ListView.builder( scrollDirection: Axis.horizontal, itemCount: snapshot.data!.articles!.length, itemBuilder: (context, index) { DateTime dateTime = DateTime.parse(snapshot .data!.articles![index].publishedAt .toString()); return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DetailScreen( DateTime: format.format(dateTime), image: snapshot .data!.articles![index].urlToImage .toString(), author: snapshot .data!.articles![index].author .toString(), newschanel: snapshot .data!.articles![index].source!.name .toString(), title: snapshot .data!.articles![index].title .toString(), description: snapshot .data!.articles![index].description .toString()))); }, child: Padding( padding: const EdgeInsets.only(right: 8), child: Container( height: hieght * .3, width: width * .6, decoration: BoxDecoration( border: Border.all( color: Colors.black.withOpacity(.05)), color: Colors.white, borderRadius: BorderRadius.circular(12)), child: Column( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( height: hieght * .2, width: width * .6, imageUrl: snapshot .data!.articles![index].urlToImage .toString(), fit: BoxFit.cover, placeholder: (context, url) => Container( child: Spinkit2, ), ), ), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: SizedBox( height: hieght * .1, width: width * .8, child: Text( snapshot .data!.articles![index].title .toString(), style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.w600), maxLines: 2, overflow: TextOverflow.ellipsis, ), ), ), SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: Text( format.format(dateTime), style: GoogleFonts.montserrat( fontWeight: FontWeight.w600, color: Colors.blue), ), ), ], ) ], ), ), ), ); }, ); } }, ), ), //Health News Horintal List SizedBox(height: hieght * .04), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "General Updates", style: GoogleFonts.montserrat( color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold), ), Text( "See all", style: GoogleFonts.montserrat( color: Colors.black54, fontSize: 16, fontWeight: FontWeight.w500), ), ], ), SizedBox(height: hieght * .015), SizedBox( height: hieght * .36, width: width, child: FutureBuilder<CatagoryNewsModel>( future: newsViewModel.fetchCatagoryNewsAPi("bitcoin"), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return Center(child: Spinkit2); } else { return ListView.builder( scrollDirection: Axis.horizontal, itemCount: snapshot.data!.articles!.length, itemBuilder: (context, index) { DateTime dateTime = DateTime.parse(snapshot .data!.articles![index].publishedAt .toString()); return InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DetailScreen( DateTime: format.format(dateTime), image: snapshot .data!.articles![index].urlToImage .toString(), author: snapshot .data!.articles![index].author .toString(), newschanel: snapshot .data!.articles![index].source!.name .toString(), title: snapshot .data!.articles![index].title .toString(), description: snapshot .data!.articles![index].description .toString()))); }, child: Padding( padding: const EdgeInsets.only(right: 8), child: Container( height: hieght * .3, width: width * .6, decoration: BoxDecoration( border: Border.all( color: Colors.black.withOpacity(.05)), color: Colors.white, borderRadius: BorderRadius.circular(12)), child: Column( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: CachedNetworkImage( height: hieght * .2, width: width * .6, imageUrl: snapshot .data!.articles![index].urlToImage .toString(), fit: BoxFit.cover, placeholder: (context, url) => Container( child: Spinkit2, ), ), ), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: SizedBox( height: hieght * .1, width: width * .8, child: Text( snapshot .data!.articles![index].title .toString(), style: GoogleFonts.montserrat( fontSize: 16, fontWeight: FontWeight.w600), maxLines: 2, overflow: TextOverflow.ellipsis, ), ), ), SizedBox( height: hieght * .01, ), Padding( padding: const EdgeInsets.symmetric( horizontal: 10), child: Text( format.format(dateTime), style: GoogleFonts.montserrat( fontWeight: FontWeight.w600, color: Colors.blue), ), ), ], ) ], ), ), ), ); }, ); } }, ), ), SizedBox(height: hieght * .04), Center( child: AnimatedTextKit( animatedTexts: [ ColorizeAnimatedText( 'discover more >', textStyle: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400), colors: colorizeColors, ), ], isRepeatingAnimation: true, onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const Catagories_News(), )); }, ), ), SizedBox(height: hieght * .04), ], ), ), ); } final Spinkit2 = const SpinKitThreeBounce( color: Colors.grey, size: 20, ); }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/login_screen.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/News_Homepage.dart'; import 'package:international_news_app/View/nav_bar.dart'; import 'package:international_news_app/View/signup_screen.dart'; class Login_Screen extends StatefulWidget { const Login_Screen({super.key}); @override State<Login_Screen> createState() => _Login_ScreenState(); } class _Login_ScreenState extends State<Login_Screen> { bool toggle = true; final _formkey = GlobalKey<FormState>(); TextEditingController emailcontroller = TextEditingController(); TextEditingController passwordcontroller = TextEditingController(); @override void dispose() { // TODO: implement dispose super.dispose(); emailcontroller.dispose(); passwordcontroller.dispose(); } @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; return Scaffold( body: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(height: hieght * .15), Center( child: Text( "Login here", style: GoogleFonts.montserrat( fontSize: 20, fontWeight: FontWeight.bold), ), ), SizedBox(height: hieght * .08), Form( key: _formkey, child: Column( children: [ TextFormField( controller: emailcontroller, decoration: InputDecoration( labelText: "Email", prefixIcon: Icon( Icons.email_outlined, size: 24, color: Colors.grey.shade600, ), border: const OutlineInputBorder()), validator: (value) { if (value!.isEmpty) { return "Please enter email"; } else { return null; } }, ), SizedBox( height: hieght * 0.04, ), TextFormField( controller: passwordcontroller, obscureText: toggle, decoration: InputDecoration( labelText: "Password", prefixIcon: Icon( Icons.lock_outline, size: 24, color: Colors.grey.shade600, ), suffixIcon: InkWell( onTap: () { setState(() { toggle = !toggle; }); }, child: toggle ? Icon( Icons.visibility_outlined, color: Colors.grey.shade600, ) : Icon( Icons.visibility_off_outlined, color: Colors.grey.shade600, )), border: const OutlineInputBorder()), validator: (value) { if (value!.isEmpty) { return "Please enter password"; } else { return null; } }, ), ], )), SizedBox( height: hieght * 0.06, ), InkWell( onTap: () { if (_formkey.currentState!.validate()) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => Bottom_Nav_Bar())); } else { return null; } }, child: Container( height: 50, decoration: BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.circular(8)), child: Center( child: Text( "Login", style: GoogleFonts.montserrat(color: Colors.white), )), ), ), SizedBox( height: hieght * 0.04, ), Row( // mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Container( height: 1, color: Colors.grey.shade300, ), ), const Text(" or "), Expanded( child: Container( height: 1, color: Colors.grey.shade300, )), ], ), SizedBox( height: hieght * 0.04, ), Row( // mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Container( height: 50, padding: const EdgeInsets.symmetric(vertical: 8), decoration: BoxDecoration( border: Border.all(color: Colors.grey.shade200)), child: const Center( child: Image(image: AssetImage("images/google.png"))), ), ), SizedBox(width: width * .04), Expanded( child: Container( height: 50, padding: const EdgeInsets.symmetric(vertical: 8), decoration: BoxDecoration( border: Border.all(color: Colors.grey.shade200)), child: const Center( child: Image( image: AssetImage("images/facebook.png"))), ), ), SizedBox(width: width * .04), Expanded( child: Container( height: 50, padding: const EdgeInsets.symmetric(vertical: 8), decoration: BoxDecoration( border: Border.all(color: Colors.grey.shade200)), child: const Center( child: Image(image: AssetImage("images/twitter.png"))), ), ), ], ), SizedBox( height: hieght * 0.06, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Don't have an account? ", style: GoogleFonts.montserrat(fontSize: 12), ), InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const Signup_Screen(), )); }, child: Text( "Create Account", style: GoogleFonts.montserrat( fontSize: 12, fontWeight: FontWeight.bold), ), ), ], ) ], ), )), ); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/home.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:international_news_app/View/News_Homepage.dart'; import 'package:international_news_app/View/nav_bar.dart'; import 'package:international_news_app/View/login_screen.dart'; import 'package:international_news_app/View/signup_screen.dart'; import 'package:animated_text_kit/animated_text_kit.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; const colorizeColors = [ Colors.white, Colors.white30, ]; return Scaffold( backgroundColor: Colors.blue, body: Padding( padding: const EdgeInsets.all(12), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ const Center( child: Icon( Icons.newspaper, color: Colors.white, size: 170, ), ), Text( "WorldWide News", style: GoogleFonts.montserrat( color: Colors.white, fontSize: 24, fontWeight: FontWeight.w700), ), SizedBox(height: hieght * .25), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const Login_Screen())); }, child: Container( height: 60, width: 120, decoration: BoxDecoration( border: Border.all(color: Colors.white, width: 2), borderRadius: BorderRadius.circular(50)), child: Center( child: Text( "Login", style: GoogleFonts.montserrat(color: Colors.white), )), ), ), InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const Signup_Screen(), )); }, child: Container( height: 60, width: 120, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(50)), child: Center( child: Text( "Sign Up", style: GoogleFonts.montserrat(color: Colors.blue), )), ), ) ], ), SizedBox(height: hieght * .06), Center( child: AnimatedTextKit( animatedTexts: [ ColorizeAnimatedText( 'Continue as a guest', textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w400), colors: colorizeColors, ), ], isRepeatingAnimation: true, onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const News_Homepage(), )); }, ), ), ], ), ), ); } }
0
mirrored_repositories/International_News_App/lib
mirrored_repositories/International_News_App/lib/View/DetailScreen.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; class DetailScreen extends StatefulWidget { final String image, title, DateTime, author, newschanel, description; DetailScreen( {super.key, required this.image, required this.author, required this.newschanel, required this.title, required this.description, required this.DateTime}); @override State<DetailScreen> createState() => _DetailScreenState(); } class _DetailScreenState extends State<DetailScreen> { @override Widget build(BuildContext context) { final hieght = MediaQuery.sizeOf(context).height * 1; final width = MediaQuery.sizeOf(context).width * 1; return SafeArea( child: Scaffold( body: Stack( children: [ Container( height: hieght * .6, width: width, decoration: BoxDecoration( image: DecorationImage( image: NetworkImage(widget.image), fit: BoxFit.cover, ), ), child: Padding( padding: const EdgeInsets.only(top: 12, left: 12), child: Align( alignment: Alignment.topLeft, child: InkWell( onTap: () { Navigator.pop(context); }, child: Container( height: hieght * .07, width: width * .12, decoration: BoxDecoration( color: Colors.white.withOpacity(.5), shape: BoxShape.circle, ), child: Icon( Icons.arrow_back, color: Colors.black, size: 24, ), ), ), ), ), ), Align( alignment: Alignment.bottomCenter, child: Expanded( child: Container( height: hieght * .5, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(20), topRight: Radius.circular(20))), child: Padding( padding: const EdgeInsets.all(10), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 6), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("by " + widget.author), Text( widget.DateTime, style: TextStyle( color: Colors.blue.shade700, ), ), ], ), SizedBox(height: 20), Text( widget.title, style: GoogleFonts.montserrat( fontSize: 20, fontWeight: FontWeight.bold), maxLines: 3, overflow: TextOverflow.ellipsis, ), SizedBox(height: 10), Text( widget.newschanel, style: GoogleFonts.montserrat( color: Colors.blue.shade700, fontWeight: FontWeight.bold), ), SizedBox(height: 20), Text( widget.description, style: GoogleFonts.montserrat( fontSize: 15, fontWeight: FontWeight.w400), ), ], ), ), ), ), ), ], ), ), ); } }
0
mirrored_repositories/International_News_App/lib/View
mirrored_repositories/International_News_App/lib/View/Mywidgets/Listtile.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; // ignore: must_be_immutable class MyList extends StatelessWidget { String title; Icon icondata; MyList({super.key, required this.title, required this.icondata}); @override Widget build(BuildContext context) { return Row( children: [ Padding( padding: EdgeInsets.only(left: 20, right: 20), child: icondata, ), SizedBox(width: 2), Text( title, style: GoogleFonts.montserrat( color: Colors.black87, fontSize: 15, fontWeight: FontWeight.w500), ) ], ); } }
0
mirrored_repositories/International_News_App/lib/View
mirrored_repositories/International_News_App/lib/View/Models/catagory_newsmodel.dart
class CatagoryNewsModel { String? status; int? totalResults; List<Articles>? articles; CatagoryNewsModel({this.status, this.totalResults, this.articles}); CatagoryNewsModel.fromJson(Map<String, dynamic> json) { status = json['status']; totalResults = json['totalResults']; if (json['articles'] != null) { articles = <Articles>[]; json['articles'].forEach((v) { articles!.add(new Articles.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = this.status; data['totalResults'] = this.totalResults; if (this.articles != null) { data['articles'] = this.articles!.map((v) => v.toJson()).toList(); } return data; } } class Articles { Source? source; String? author; String? title; String? description; String? url; String? urlToImage; String? publishedAt; String? content; Articles( {this.source, this.author, this.title, this.description, this.url, this.urlToImage, this.publishedAt, this.content}); Articles.fromJson(Map<String, dynamic> json) { source = json['source'] != null ? new Source.fromJson(json['source']) : null; author = json['author']; title = json['title']; description = json['description']; url = json['url']; urlToImage = json['urlToImage']; publishedAt = json['publishedAt']; content = json['content']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.source != null) { data['source'] = this.source!.toJson(); } data['author'] = this.author; data['title'] = this.title; data['description'] = this.description; data['url'] = this.url; data['urlToImage'] = this.urlToImage; data['publishedAt'] = this.publishedAt; data['content'] = this.content; return data; } } class Source { String? id; String? name; Source({this.id, this.name}); Source.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; return data; } }
0
mirrored_repositories/International_News_App/lib/View
mirrored_repositories/International_News_App/lib/View/Models/news_chanel_headlines_model.dart
class NewsChanelHeadlinesModel { String? status; int? totalResults; List<Articles>? articles; NewsChanelHeadlinesModel({this.status, this.totalResults, this.articles}); NewsChanelHeadlinesModel.fromJson(Map<String, dynamic> json) { status = json['status']; totalResults = json['totalResults']; if (json['articles'] != null) { articles = <Articles>[]; json['articles'].forEach((v) { articles!.add(new Articles.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['status'] = this.status; data['totalResults'] = this.totalResults; if (this.articles != null) { data['articles'] = this.articles!.map((v) => v.toJson()).toList(); } return data; } } class Articles { Source? source; String? author; String? title; String? description; String? url; String? urlToImage; String? publishedAt; String? content; Articles( {this.source, this.author, this.title, this.description, this.url, this.urlToImage, this.publishedAt, this.content}); Articles.fromJson(Map<String, dynamic> json) { source = json['source'] != null ? new Source.fromJson(json['source']) : null; author = json['author']; title = json['title']; description = json['description']; url = json['url']; urlToImage = json['urlToImage']; publishedAt = json['publishedAt']; content = json['content']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.source != null) { data['source'] = this.source!.toJson(); } data['author'] = this.author; data['title'] = this.title; data['description'] = this.description; data['url'] = this.url; data['urlToImage'] = this.urlToImage; data['publishedAt'] = this.publishedAt; data['content'] = this.content; return data; } } class Source { String? id; String? name; Source({this.id, this.name}); Source.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['name'] = this.name; return data; } }
0
mirrored_repositories/International_News_App
mirrored_repositories/International_News_App/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:international_news_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/state_management_starting
mirrored_repositories/state_management_starting/lib/counter_view.dart
import 'package:flutter/material.dart'; class CounterView extends StatefulWidget { const CounterView({Key? key}) : super(key: key); @override State<CounterView> createState() => _CounterViewState(); } class _CounterViewState extends State<CounterView> { @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( appBar: AppBar( title: Text("State management"), ), body: Center( child: Text( "0", style: TextStyle(fontSize: 50.0), ), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () {}, ), ), ); } }
0
mirrored_repositories/state_management_starting
mirrored_repositories/state_management_starting/lib/main.dart
import 'package:flutter/material.dart'; import 'package:state_management_starting/counter_view.dart'; void main() { runApp( const MyApp(), ); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( home: CounterView(), ); } }
0
mirrored_repositories/state_management_starting
mirrored_repositories/state_management_starting/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:state_management_starting/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/RentalApp-Flutter
mirrored_repositories/RentalApp-Flutter/lib/main.dart
import 'package:flutter/material.dart'; import 'package:rentalapp_flutter/Screen/Home.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( body: DashBoardPage(), ); } }
0
mirrored_repositories/RentalApp-Flutter/lib
mirrored_repositories/RentalApp-Flutter/lib/Screen/Home.dart
import 'package:flutter/material.dart'; import 'package:flutter_signin_button/flutter_signin_button.dart'; import 'package:rentalapp_flutter/Screen/HomePage.dart'; void main() { runApp(DashBoardPage()); } class DashBoardPage extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: DashboardHome(title: 'Dashboard',), theme: new ThemeData( pageTransitionsTheme: PageTransitionsTheme(builders: {TargetPlatform.android: ZoomPageTransitionsBuilder(),}), ), ); } } class DashboardHome extends StatefulWidget { DashboardHome({Key key, this.title}) : super(key: key); final String title; @override _DashboardState createState() => _DashboardState(); } class _DashboardState extends State<DashboardHome> { final GlobalKey<NavigatorState> _navigatorKey = GlobalKey<NavigatorState>(); int _currentTabIndex = 0; Widget _bottomNavigationBar() { return BottomNavigationBar( type: BottomNavigationBarType.fixed, items: [ BottomNavigationBarItem( icon: Icon(Icons.home), title: Text("Home"), ), BottomNavigationBarItem( icon: Icon(Icons.chat), title: Text("Chats") ), BottomNavigationBarItem( icon: Icon(Icons.favorite), title: Text("My Adds"), ), BottomNavigationBarItem( icon: Icon(Icons.settings), title: Text("Settings"), ) ], onTap: _onTap, currentIndex: _currentTabIndex, ); } _onTap(int tabIndex) { switch (tabIndex) { case 0: _navigatorKey.currentState.pushReplacementNamed("Home"); break; case 1: _navigatorKey.currentState.pushReplacementNamed("Chats"); break; case 2: _navigatorKey.currentState.pushReplacementNamed("My_Adds"); break; case 3: _navigatorKey.currentState.pushReplacementNamed("Settings"); break; } setState(() { _currentTabIndex = tabIndex; }); } Route<dynamic> generateRoute(RouteSettings settings) { switch (settings.name) { case "Account": return MaterialPageRoute(builder: (context) => Container(color: Colors.blue,child: Center(child: Text("Account")))); case "Settings": return MaterialPageRoute(builder: (context) => Container(color: Colors.green,child: Center(child: Text("Settings")))); case "My_Adds": return MaterialPageRoute(builder: (context) => Container(color: Colors.blueGrey,child: Center(child: Text("My Adds")))); case "Chats": return MaterialPageRoute(builder: (context) => Container(color: Colors.red,child: Center(child: Text("Chats")))); default: return MaterialPageRoute(builder: (context) => HomePage()); } } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: Color(0xffffffff), bottomNavigationBar: _bottomNavigationBar(), body: Navigator(key: _navigatorKey, onGenerateRoute: generateRoute), ); } }
0
mirrored_repositories/RentalApp-Flutter/lib
mirrored_repositories/RentalApp-Flutter/lib/Screen/HomePage.dart
import 'package:flutter/material.dart'; import 'package:flutter_signin_button/flutter_signin_button.dart'; void main() { runApp(HomePage()); } class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Home(title: 'Home',); } } class Home extends StatefulWidget { Home({Key key, this.title}) : super(key: key); final String title; @override _HomeState createState() => _HomeState(); } class _HomeState extends State<Home> { @override Widget build(BuildContext context) { return Scaffold( body: Container( child: Column( children: <Widget>[ Container( height: 120, padding: EdgeInsets.only(top: 50, left: 20, right: 20, bottom: 10), child: Row( children: <Widget>[ Expanded( child: Container( child: InkWell( splashColor: Colors.transparent, highlightColor: Colors.transparent, // makes highlight invisible too onTap: (){ print('working'); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text('Your Location', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),), Container( padding: EdgeInsets.only(top: 7), child: Row( children: <Widget>[ Icon(Icons.location_on, color: Colors.grey[750],size: 15,), SizedBox(width: 10,), Text('Chennai'), SizedBox(width: 5,), Icon(Icons.keyboard_arrow_down) ], ), ) ], ), ) ) ), SizedBox(width: 20,), Icon(Icons.notifications, color: Colors.grey[700],size: 30,) ], ), ), Container( padding: EdgeInsets.only(left: 20, right: 20, top: 5), child: Row( children: [ Expanded( child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(50), color: Colors.grey[200], ), child: TextField( decoration: InputDecoration( prefixIcon: Icon(Icons.search, color: Colors.grey,), hintText: 'Search', hintStyle: TextStyle(color: Colors.grey), border: InputBorder.none ), ), ), ), ], ), ), Expanded( child: SingleChildScrollView( scrollDirection: Axis.vertical, child: Padding( padding: EdgeInsets.all(23), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: TextBaseline.alphabetic, children: <Widget>[ Text("Categories", style: new TextStyle(fontSize: 25.0,color: Colors.grey[900],fontWeight: FontWeight.bold),), Text("See All"), ], ), Container( height: 100, padding: EdgeInsets.only(top: 20), child: ScrollConfiguration( behavior: ListViewBehaviour(), child: ListView( scrollDirection: Axis.horizontal, shrinkWrap: true, children: <Widget>[ makeCategory(cat_image: 'assets/category/bike.png',title: 'Bikes'), makeCategory(cat_image: 'assets/category/mobile.png',title: 'Mobile'), makeCategory(cat_image: 'assets/category/cars.png',title: 'Cars'), makeCategory(cat_image: 'assets/category/electronics.png',title: 'Electronics'), makeCategory(cat_image: 'assets/category/fashion.png',title: 'Fashion'), makeCategory(cat_image: 'assets/category/books.png',title: 'Books'), makeCategory(cat_image: 'assets/category/sports.png',title: 'Sports'), makeCategory(cat_image: 'assets/category/bike.png',title: 'Bikes'), ], ), ), ), SizedBox(height: 30,), Container( padding: EdgeInsets.only(top: 20), child: ScrollConfiguration( behavior: ListViewBehaviour(), child: ListView( physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, children: <Widget>[ makeFeed(cat_image: 'https://akm-img-a-in.tosshub.com/indiatoday/images/story/202003/Avoid_leaving_your_bike_in_ope.jpeg?.TfqAOzq1QVagtkIT4jP0omM54xiHQgI&size=770:433',title: 'Bikes'), SizedBox(height: 2,child: Container(color: Colors.grey[200],),), makeFeed(cat_image: 'https://i.ytimg.com/vi/R7Vz4lQQQGo/maxresdefault.jpg',title: 'Mobile'), SizedBox(height: 2,child: Container(color: Colors.grey[200],),), makeFeed(cat_image: 'https://www.cartoq.com/wp-content/uploads/2019/08/swift-featured.jpg',title: 'Cars'), SizedBox(height: 2,child: Container(color: Colors.grey[200],),), makeFeed(cat_image: 'https://apollo-singapore.akamaized.net/v1/files/gamnsho6uvhi3-IN/image;s=272x0',title: 'Electronics'), SizedBox(height: 2,child: Container(color: Colors.grey[200],),), makeFeed(cat_image: 'https://i.ytimg.com/vi/R7Vz4lQQQGo/maxresdefault.jpg',title: 'Fashion'), SizedBox(height: 2,child: Container(color: Colors.grey[200],),), makeFeed(cat_image: 'https://i.ytimg.com/vi/R7Vz4lQQQGo/maxresdefault.jpg',title: 'Books'), SizedBox(height: 2,child: Container(color: Colors.grey[200],),), makeFeed(cat_image: 'https://i.ytimg.com/vi/R7Vz4lQQQGo/maxresdefault.jpg',title: 'Sports'), SizedBox(height: 2,child: Container(color: Colors.grey[200],),), makeFeed(cat_image: 'https://i.ytimg.com/vi/R7Vz4lQQQGo/maxresdefault.jpg',title: 'Bikes'), ], ), ), ), ], ), ), ), ) ], ), ), ); } Widget makeCategory({cat_image,title}){ return( AspectRatio( aspectRatio: 1/.8, child: Container( padding: EdgeInsets.all(5), margin: EdgeInsets.only(right: 30,), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), image: DecorationImage(image: AssetImage(cat_image),scale: 1, fit: BoxFit.fitWidth), ), child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), gradient: LinearGradient( begin: Alignment.bottomRight, colors: [ Colors.blue.withOpacity(.1), Colors.blue.withOpacity(.1) ] ) ), ), ), ) ); } Widget makeFeed({cat_image,title}){ return Container( margin: EdgeInsets.only(bottom: 20, left: 5, top: 5), child: Row( children: <Widget>[ Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), ), height: 100, child: Image.network(cat_image, width: 200,), ), Container( height: 60, padding: EdgeInsets.only(left: 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: <Widget>[ Align( alignment: Alignment.topLeft, child: Text(title, style: TextStyle(fontSize: 23),), ), Text('Joan Louji') ], ), ), ], ), ); } } class ListViewBehaviour extends ScrollBehavior { @override Widget buildViewportChrome( BuildContext context, Widget child, AxisDirection axisDirection) { return child; } }
0
mirrored_repositories/RentalApp-Flutter
mirrored_repositories/RentalApp-Flutter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:rentalapp_flutter/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/flutter-app
mirrored_repositories/flutter-app/lib/story_brain.dart
import 'story.dart'; class StoryBrain { int _storyNumber = 0; final List<Story> _storyData = [ Story( storyTitle: 'Your car has blown a tire on a winding road in the middle of nowhere with no cell phone reception. You decide to hitchhike. A rusty pickup truck rumbles to a stop next to you. A man with a wide brimmed hat with soulless eyes opens the passenger door for you and asks: "Need a ride, boy?".', choice1: 'I\'ll hop in. Thanks for the help!', choice2: 'Better ask him if he\'s a murderer first.'), Story( storyTitle: 'He nods slowly, unphased by the question.', choice1: 'At least he\'s honest. I\'ll climb in.', choice2: 'Wait, I know how to change a tire.'), Story( storyTitle: 'As you begin to drive, the stranger starts talking about his relationship with his mother. He gets angrier and angrier by the minute. He asks you to open the glovebox. Inside you find a bloody knife, two severed fingers, and a cassette tape of Elton John. He reaches for the glove box.', choice1: 'I love Elton John! Hand him the cassette tape.', choice2: 'It\'s him or me! You take the knife and stab him.'), Story( storyTitle: 'What? Such a cop out! Did you know traffic accidents are the second leading cause of accidental death for most adult age groups?', choice1: 'Restart', choice2: ''), Story( storyTitle: 'As you smash through the guardrail and careen towards the jagged rocks below you reflect on the dubious wisdom of stabbing someone while they are driving a car you are in.', choice1: 'Restart', choice2: ''), Story( storyTitle: 'You bond with the murderer while crooning verses of "Can you feel the love tonight". He drops you off at the next town. Before you go he asks you if you know any good places to dump bodies. You reply: "Try the pier".', choice1: 'Restart', choice2: '') ]; String getStory() => _storyData[_storyNumber].storyTitle; String getChoice1() => _storyData[_storyNumber].choice1; String getChoice2() => _storyData[_storyNumber].choice2; void restart() => _storyNumber = 0; void nextStory(int choiceNumber) { if (choiceNumber == 1 && _storyNumber == 0) { _storyNumber = 2; } else if (choiceNumber == 2 && _storyNumber == 0) { _storyNumber = 1; } else if (choiceNumber == 1 && _storyNumber == 1) { _storyNumber = 2; } else if (choiceNumber == 2 && _storyNumber == 1) { _storyNumber = 3; } else if (choiceNumber == 1 && _storyNumber == 2) { _storyNumber = 5; } else if (choiceNumber == 2 && _storyNumber == 2) { _storyNumber = 4; } else if (_storyNumber == 3 || _storyNumber == 4 || _storyNumber == 5) { restart(); } } bool buttonShouldBeVisible() { if (_storyNumber == 0 || _storyNumber == 1 || _storyNumber == 2) { return true; } return false; } } //TODO: Step 27 - Create a method called buttonShouldBeVisible() which checks to see if storyNumber is 0 or 1 or 2 (when both buttons should show choices) and return true if that is the case, else it should return false.
0
mirrored_repositories/flutter-app
mirrored_repositories/flutter-app/lib/story.dart
class Story { String storyTitle; String choice1; String choice2; Story( {required this.storyTitle, required this.choice1, required this.choice2}); }
0
mirrored_repositories/flutter-app
mirrored_repositories/flutter-app/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_app/story_brain.dart'; void main() => runApp(const Destini()); class Destini extends StatelessWidget { const Destini({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.dark(), home: const StoryPage(), ); } } StoryBrain storyBrain = StoryBrain(); class StoryPage extends StatefulWidget { const StoryPage({Key? key}) : super(key: key); @override _StoryPageState createState() => _StoryPageState(); } class _StoryPageState extends State<StoryPage> { @override Widget build(BuildContext context) { return Scaffold( body: Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/background.png'), fit: BoxFit.cover, ), ), padding: const EdgeInsets.symmetric(vertical: 50.0, horizontal: 15.0), constraints: const BoxConstraints.expand(), child: SafeArea( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Expanded( flex: 12, child: Center( child: Text( storyBrain.getStory(), style: const TextStyle( fontSize: 25.0, ), ), ), ), Expanded( flex: 2, child: FlatButton( onPressed: () { setState(() { storyBrain.nextStory(1); }); }, color: Colors.red, child: Text( storyBrain.getChoice1(), style: const TextStyle( fontSize: 20.0, ), ), ), ), const SizedBox( height: 20.0, ), Visibility( visible: storyBrain.buttonShouldBeVisible(), child: Expanded( flex: 2, child: FlatButton( onPressed: () { setState(() { storyBrain.nextStory(2); }); }, color: Colors.blue, child: Text( storyBrain.getChoice2(), style: const TextStyle( fontSize: 20.0, ), ), ), ), ), ], ), ), ), ); } } //TODO: Step 29 - Run the app and test it against the Story Outline to make sure you've completed all the steps. The code for the completed app can be found here: https://github.com/londonappbrewery/destini-challenge-completed/
0
mirrored_repositories/flutter-app
mirrored_repositories/flutter-app/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. // await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-Apps-Collection/flutterredux
mirrored_repositories/Flutter-Apps-Collection/flutterredux/lib/main.dart
import 'package:flutter/material.dart'; import 'package:meta/meta.dart'; import 'package:redux/redux.dart'; import 'package:flutter_redux/fullter_redux.dart'; void main() => runApp(new MyApp()); @immutable class AppState { final counter; AppState(this.counter); } enum Actions { Increment } AppState reducer(AppState prev, acton) { if (acton == Actions.Increment) return new AppState(prev.counter + 1); return prev; } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return new MaterialApp( title: 'Flutter Demo', theme: new ThemeData( primarySwatch: Colors.blue, ), home: new MyHomePage(), ); } } class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text("Redux App"), ), body: new Center( child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ new Text( 'You have pushed the button this many times:', ), new Text( '0', style: Theme.of(context).textTheme.display1, ), ], ), ), floatingActionButton: new FloatingActionButton( tooltip: 'Increment', child: new Icon(Icons.add), ), // This trailing comma makes auto-formatting nicer for build methods. ); } }
0
mirrored_repositories/Flutter-Apps-Collection/flutterredux
mirrored_repositories/Flutter-Apps-Collection/flutterredux/test/widget_test.dart
// This is a basic Flutter widget test. // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to // find child widgets in the widget tree, read text, and verify that the values of widget properties // are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutterredux/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(new MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Pokemon-App
mirrored_repositories/Pokemon-App/lib/homepage.dart
import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:pokemon_app/Screens/poke_detail.dart'; import 'package:pokemon_app/pokedox.dart'; import 'dart:convert'; import 'widgets/drawer.dart'; import 'widgets/home_body.dart'; class HomePage extends StatefulWidget { @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { var url="https://raw.githubusercontent.com/Biuni/PokemonGO-Pokedex/master/pokedex.json"; PokeHub pokeHub; @override void initState(){ super.initState(); fetchData(); } fetchData() async{ var res= await http.get(url); var decodedJSON= jsonDecode(res.body); pokeHub=PokeHub.fromJson(decodedJSON); setState(() { }); } Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( title: Text( "MY POKEMON'S", style: TextStyle(fontSize: 18, color: Colors.red), ), backgroundColor: Colors.black, ), floatingActionButton: FloatingActionButton( child: Icon( Icons.refresh, color: Colors.white, ), backgroundColor: Colors.red[900], onPressed: () { initState(); }, ), drawer: AppDrawer(), body:pokeHub==null?Center(child: CircularProgressIndicator( backgroundColor: Colors.black, valueColor: AlwaysStoppedAnimation<Color>(Colors.red), ),):GridView.count( crossAxisCount: 2, children: pokeHub.pokemon.map((poke)=> Padding( padding: const EdgeInsets.all(5.0), child: InkWell( onTap:(){ Navigator.push(context, MaterialPageRoute(builder: (context)=>PokeDetail( pokemon:poke ))); }, child: Hero( tag:poke.img, child: Card( elevation: 30.0, // color:Colors.red[900], // shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Container( width: 100, height: 100, decoration: BoxDecoration( image:DecorationImage(image: NetworkImage(poke.img)) ), ), SizedBox(height:10), Text(poke.name, style: TextStyle(fontSize: 20,fontWeight: FontWeight.bold)) ], ), ), ), ), ), )).toList(), ) ); } }
0
mirrored_repositories/Pokemon-App
mirrored_repositories/Pokemon-App/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'homepage.dart'; void main() => runApp(MaterialApp( title: "Hello World", home: HomePage(), debugShowCheckedModeBanner: false, themeMode: ThemeMode.dark, theme: ThemeData(brightness: Brightness.dark, primaryColor: Colors.red), ));
0
mirrored_repositories/Pokemon-App
mirrored_repositories/Pokemon-App/lib/pokedox.dart
class PokeHub { List<Pokemon> pokemon; PokeHub({this.pokemon}); PokeHub.fromJson(Map<String, dynamic> json) { if (json['pokemon'] != null) { pokemon = new List<Pokemon>(); json['pokemon'].forEach((v) { pokemon.add(new Pokemon.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); if (this.pokemon != null) { data['pokemon'] = this.pokemon.map((v) => v.toJson()).toList(); } return data; } } class Pokemon { int id; String num; String name; String img; List<String> type; String height; String weight; String candy; int candyCount; String egg; String spawnChance; String avgSpawns; String spawnTime; List<double> multipliers; List<String> weaknesses; List<NextEvolution> nextEvolution; Pokemon( {this.id, this.num, this.name, this.img, this.type, this.height, this.weight, this.candy, this.candyCount, this.egg, this.spawnChance, this.avgSpawns, this.spawnTime, this.multipliers, this.weaknesses, this.nextEvolution}); Pokemon.fromJson(Map<String, dynamic> json) { id = json['id']; num = json['num']; name = json['name']; img = json['img']; type = json['type'].cast<String>(); height = json['height']; weight = json['weight']; candy = json['candy']; candyCount = json['candy_count']; egg = json['egg']; spawnChance = json['spawn_chance'].toString(); avgSpawns = json['avg_spawns'].toString(); spawnTime = json['spawn_time']; multipliers = json['multipliers']?.cast<double>(); weaknesses = json['weaknesses'].cast<String>(); if (json['next_evolution'] != null) { nextEvolution = new List<NextEvolution>(); json['next_evolution'].forEach((v) { nextEvolution.add(new NextEvolution.fromJson(v)); }); } } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['id'] = this.id; data['num'] = this.num; data['name'] = this.name; data['img'] = this.img; data['type'] = this.type; data['height'] = this.height; data['weight'] = this.weight; data['candy'] = this.candy; data['candy_count'] = this.candyCount; data['egg'] = this.egg; data['spawn_chance'] = this.spawnChance; data['avg_spawns'] = this.avgSpawns; data['spawn_time'] = this.spawnTime; data['multipliers'] = this.multipliers; data['weaknesses'] = this.weaknesses; if (this.nextEvolution != null) { data['next_evolution'] = this.nextEvolution.map((v) => v.toJson()).toList(); } return data; } } class NextEvolution { String num; String name; NextEvolution({this.num, this.name}); NextEvolution.fromJson(Map<String, dynamic> json) { num = json['num']; name = json['name']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = new Map<String, dynamic>(); data['num'] = this.num; data['name'] = this.name; return data; } }
0
mirrored_repositories/Pokemon-App/lib
mirrored_repositories/Pokemon-App/lib/widgets/home_body.dart
import 'package:flutter/material.dart'; class HomeBody extends StatefulWidget { @override _HomeBodyState createState() => _HomeBodyState(); } class _HomeBodyState extends State<HomeBody> { @override Widget build(BuildContext context) { return Center( child: Container(width: 200, height: 200, decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.red[900]), ), ); } }
0
mirrored_repositories/Pokemon-App/lib
mirrored_repositories/Pokemon-App/lib/widgets/drawer.dart
import 'package:flutter/material.dart'; import 'package:pokemon_app/Screens/about.dart'; import '../homepage.dart'; class AppDrawer extends StatelessWidget { @override Widget build(BuildContext context) { return Drawer( child: ListView( padding: const EdgeInsets.all(0), children: <Widget>[ UserAccountsDrawerHeader( accountEmail: Text("[email protected]",style:TextStyle(color: Colors.black)), accountName: Text("Ishan Sharma",style:TextStyle(fontSize: 24,color: Colors.black)), arrowColor: Colors.black, onDetailsPressed: (){}, currentAccountPicture: CircleAvatar( backgroundImage: NetworkImage("http://www.ishandeveloper.com/2020%20[old]/assets/img/profile.JPG"), ), ), Padding( padding: const EdgeInsets.symmetric(horizontal:16), child: ListTile( leading: Icon(Icons.pages), title: Text("Catalogue"), subtitle: Text("Info about every pokemon"), onTap: (){ Navigator.push(context, MaterialPageRoute(builder: (context)=>HomePage() )); }, ), ), Padding( padding: const EdgeInsets.symmetric(horizontal:16), child: ListTile( leading: Icon(Icons.info_outline), title: Text("About"), subtitle: Text("App Creator & Version"), onTap: (){ Navigator.push(context, MaterialPageRoute(builder: (context)=>AboutPage() )); }, ), ) ], ), ); } }
0
mirrored_repositories/Pokemon-App/lib
mirrored_repositories/Pokemon-App/lib/Screens/poke_detail.dart
import 'package:flutter/material.dart'; import 'package:pokemon_app/pokedox.dart'; import 'package:pokemon_app/widgets/drawer.dart'; class PokeDetail extends StatelessWidget { final Pokemon pokemon; PokeDetail({this.pokemon}); bodyWidget(BuildContext context)=>Stack( children: <Widget>[ Positioned( height: MediaQuery.of(context).size.height/1.5, width: MediaQuery.of(context).size.width-60, left:30, top: MediaQuery.of(context).size.height*0.1, child: Card( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), elevation: 10, // color:Colors.black12, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ SizedBox(height: 50,), Text(pokemon.name,style:TextStyle(fontSize: 30,fontWeight: FontWeight.bold)), Text("Height: ${pokemon.height}",style:TextStyle(fontSize: 16)), Text("Weight: ${pokemon.weight}",style:TextStyle(fontSize: 16)), Text("Types",style:TextStyle(fontSize: 16,fontWeight: FontWeight.bold)), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: pokemon.type.map( (t)=>FilterChip( label: Text(t), backgroundColor:Colors.green, onSelected: (b){}) ).toList(), ), Text("Weakness",style:TextStyle(fontSize: 16,fontWeight: FontWeight.bold)), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: pokemon.weaknesses.map( (t)=>FilterChip( label: Text(t), backgroundColor:Colors.red, onSelected: (b){}) ).toList(), ), Text("Next Evolution",style:TextStyle(fontSize: 16,fontWeight: FontWeight.bold)), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: pokemon.nextEvolution!=null?pokemon.nextEvolution.map( (n)=>FilterChip( label: Text(n.name), backgroundColor:Colors.blue[300], onSelected: (b){}) ).toList():List(), ), ], ), ), ), Align( alignment:Alignment.topCenter, child:Hero( tag: pokemon.img, child: Container( height: 200, width: 200, decoration: BoxDecoration( image:DecorationImage(image:NetworkImage(pokemon.img),fit: BoxFit.cover) ), ), ) ) ], ); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title:Text(pokemon.name,style:TextStyle(fontWeight: FontWeight.bold,color: Colors.red)), backgroundColor: Colors.black, // centerTitle: true, iconTheme: IconThemeData( color: Colors.red, // opacity: 0 ), ), body:bodyWidget(context), backgroundColor: Colors.black, ); } }
0
mirrored_repositories/Pokemon-App/lib
mirrored_repositories/Pokemon-App/lib/Screens/about.dart
import 'package:flutter/material.dart'; import 'package:pokemon_app/widgets/drawer.dart'; class AboutPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( title:Text("About PokeApp",style:TextStyle(color: Colors.red)), backgroundColor: Colors.black, iconTheme: IconThemeData(color: Colors.red), ), drawer: AppDrawer(), body: Stack( children: <Widget>[ Positioned( child: Center( child: Container( height: MediaQuery.of(context).size.height/2, width: MediaQuery.of(context).size.width-100, child: Card( color: Colors.red, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), child: Column( children: <Widget>[ SizedBox(height: 120,), Padding( padding: const EdgeInsets.symmetric(horizontal:30), child: Text("One of the first few apps I made while on my journey to learn flutter.", textAlign: TextAlign.center, ), ), SizedBox(height: 50,), Text("You can find the whole source code on",style:TextStyle(fontSize: 12,fontStyle: FontStyle.normal)), Text("github.com/ishandeveloper",style:TextStyle(fontSize: 14,fontWeight: FontWeight.bold)), SizedBox(height: 50,), Text("Made with ❤ by",style:TextStyle(fontSize: 12,fontStyle: FontStyle.normal)), Text("@ishandeveloper",style:TextStyle(fontSize: 20,fontWeight: FontWeight.bold)), Padding( padding: const EdgeInsets.symmetric(horizontal:25.0,vertical: 8.0), child: Text("A passionate learner and obsessive seeker of IT knowledge.", style:TextStyle(), textAlign: TextAlign.center,), ), SizedBox(height: 20,), Text("Special Thanks To @PawanKumar",style: TextStyle(fontStyle: FontStyle.italic),) ], ), ) ), ),), Align( alignment:Alignment.topCenter, child:Padding( padding: const EdgeInsets.symmetric(vertical:80.0), child: Container( height: 200, width: 200, child: CircleAvatar( backgroundImage: NetworkImage("http://www.ishandeveloper.com/2020%20[old]/assets/img/profile.JPG",), ), ), ), ) ], ), ); } }
0
mirrored_repositories/News-app-flutter-bloc
mirrored_repositories/News-app-flutter-bloc/lib/main.dart
import 'package:dispatcher/bloc/navbar_main/navbar_main_bloc.dart'; import 'package:dispatcher/repository/articles_repository.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'ui/pages/navbar_main_page.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Dispatcher Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: RepositoryProvider( create: (_) => ArticlesRepository(), child: NavbarMainPage() ), ); } }
0
mirrored_repositories/News-app-flutter-bloc/lib
mirrored_repositories/News-app-flutter-bloc/lib/network/dio_exceptions.dart
import 'package:dio/dio.dart'; class DioExceptions implements Exception { late final String message; DioExceptions.fromDioError(DioError dioError) { switch (dioError.type) { case DioErrorType.cancel: message = "Request to API server was cancelled"; break; case DioErrorType.connectTimeout: message = "Connection timeout with API server"; break; case DioErrorType.receiveTimeout: message = "Receive timeout in connection with API server"; break; case DioErrorType.response: message = _handleError( dioError.response?.statusCode, dioError.response?.data, ); break; case DioErrorType.sendTimeout: message = "Send timeout in connection with API server"; break; case DioErrorType.other: if (dioError.message.contains("SocketException")) { message = 'No Internet'; break; } message = "Unexpected error occurred"; break; default: message = "Something went wrong"; break; } } String _handleError(int? statusCode, dynamic error) { switch (statusCode) { case 400: return 'Bad request'; case 401: return 'Unauthorized'; case 403: return 'Forbidden'; case 404: return error['message']; case 500: return 'Internal server error'; case 502: return 'Bad gateway'; default: return 'Oops something went wrong'; } } @override String toString() => message; }
0
mirrored_repositories/News-app-flutter-bloc/lib
mirrored_repositories/News-app-flutter-bloc/lib/network/dio_client.dart
import 'package:dio/dio.dart'; import 'package:dispatcher/constants/constants.dart'; class DioClient { static const int testDelaySec = 0; static final instance = DioClient._(); final Dio _dio = Dio(); DioClient._() { _dio.options ..baseUrl = Constants.baseUrl ..connectTimeout = Constants.connectionTimeout ..receiveTimeout = Constants.receiveTimeout ..responseType = ResponseType.json; } // Get:----------------------------------------------------------------------- Future<Response> get( String url, { Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onReceiveProgress, }) async { try { final Response response = await _dio.get( url, queryParameters: queryParameters, options: options, cancelToken: cancelToken, onReceiveProgress: onReceiveProgress, ); return response; } catch (e) { rethrow; } } // Post:---------------------------------------------------------------------- Future<Response> post( String url, { data, Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { try { final Response response = await _dio.post( url, data: data, queryParameters: queryParameters, options: options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); return response; } catch (e) { rethrow; } } // Put:----------------------------------------------------------------------- Future<Response> put( String url, { data, Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { try { final Response response = await _dio.put( url, data: data, queryParameters: queryParameters, options: options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); return response; } catch (e) { rethrow; } } // Delete:-------------------------------------------------------------------- Future<dynamic> delete( String url, { data, Map<String, dynamic>? queryParameters, Options? options, CancelToken? cancelToken, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { try { final Response response = await _dio.delete( url, data: data, queryParameters: queryParameters, options: options, cancelToken: cancelToken, ); return response.data; } catch (e) { rethrow; } } }
0
mirrored_repositories/News-app-flutter-bloc/lib
mirrored_repositories/News-app-flutter-bloc/lib/constants/app_colors.dart
import 'package:flutter/material.dart'; class AppColors { static const appBackground = Color(0xff262146); static const surfaceBg = Color(0xffF8F8FF); static const iconColor = Colors.white; }
0
mirrored_repositories/News-app-flutter-bloc/lib
mirrored_repositories/News-app-flutter-bloc/lib/constants/constants.dart
class Constants { static const apiKey = '3b3215dc555a4347925f9d04aa05c279'; static const baseUrl = "https://newsapi.org/v2/"; static const connectionTimeout = 15000; static const receiveTimeout = 15000; static const appBarHeight = 64.0; static const appBarElevation = 6.0; }
0
mirrored_repositories/News-app-flutter-bloc/lib
mirrored_repositories/News-app-flutter-bloc/lib/repository/articles_repository.dart
import 'dart:developer'; import 'package:dio/dio.dart'; import 'package:dispatcher/api/articles/responses/get_everything_response.dart'; import 'package:dispatcher/model/article.dart'; import '../api/articles/articles_api.dart'; import '../network/dio_exceptions.dart'; class ArticlesRepository { final ArticlesApi articlesApi = ArticlesApi(); ArticlesRepository(); Future<List<Article>> getEveryArticles() async { try { final GetEverythingResponse response = await articlesApi.getEverything(); return response.articles.map((articleDto) => Article.fromDto(articleDto) ).toList(); } on DioError catch (e) { final errorMessage = DioExceptions.fromDioError(e).toString(); throw errorMessage; } } Future<List<Article>> getPageTopHeadlines(int pageNum, String? query) async { try { log("ArticlesRepository: getPageTopHeadlines(): pageNum = $pageNum"); final GetEverythingResponse response = await articlesApi.getTopHeadlines( pageNum, query ); return response.articles.map((articleDto) => Article.fromDto(articleDto) ).toList(); } on DioError catch (e) { final errorMessage = DioExceptions.fromDioError(e).toString(); throw errorMessage; } } }
0
mirrored_repositories/News-app-flutter-bloc/lib/bloc
mirrored_repositories/News-app-flutter-bloc/lib/bloc/navbar_main/navbar_main_event.dart
part of 'navbar_main_bloc.dart'; @immutable abstract class NavbarMainEvent { const NavbarMainEvent(); } class NavbarItemPressed extends NavbarMainEvent { const NavbarItemPressed(this.tappedItem); final NavbarItem tappedItem; }
0