repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/Flutter-Delivery-App/lib/data
mirrored_repositories/Flutter-Delivery-App/lib/data/repersitory/recommended_product_repo.dart
import 'package:get/get.dart'; import 'package:meli_melo/data/api/api_client.dart'; import '../../utils/app_constants.dart'; class RecommendedProductRepo extends GetxService{ final ApiClient apiClient; RecommendedProductRepo({required this.apiClient}); Future<Response> getRecommendedProductList() async{ return await apiClient.getData(AppConstants.RECOMMENDED_PRODUCT_URI); } }
0
mirrored_repositories/Flutter-Delivery-App/lib
mirrored_repositories/Flutter-Delivery-App/lib/helper/dependencies.dart
import 'package:get/get.dart'; import 'package:meli_melo/controllers/cart_controller.dart'; import 'package:meli_melo/data/api/api_client.dart'; import 'package:meli_melo/data/repersitory/cart_repo.dart'; import 'package:meli_melo/data/repersitory/popular_product_repo.dart'; import '../controllers/popular_product_controller.dart'; import '../controllers/recommanded_product_controller.dart'; import '../data/repersitory/recommended_product_repo.dart'; import '../utils/app_constants.dart'; Future<void> init()async { //api client Get.lazyPut(()=>ApiClient(appBaseUrl:AppConstants.BASE_URL)); //repos Get.lazyPut(() => PopularProductRepo(apiClient: Get.find())); Get.lazyPut(() => RecommendedProductRepo(apiClient: Get.find())); Get.lazyPut(() => CartRepo()); //controller Get.lazyPut(() => PopularProductController(popularProductRepo: Get.find())); Get.lazyPut(() => RecommendedProductController(recommendedProductRepo: Get.find())); Get.lazyPut(() => CartController(cartRepo: Get.find())); }
0
mirrored_repositories/Flutter-Delivery-App/lib
mirrored_repositories/Flutter-Delivery-App/lib/utils/app_constants.dart
class AppConstants{ static const String APP_NAME = "DBFood"; static const int APP_VERSION = 1; static const String BASE_URL = "http://mvs.bslmeiyu.com"; static const String POPULAR_PRODUCT_URI = "/api/v1/products/popular"; static const String RECOMMENDED_PRODUCT_URI = "/api/v1/products/recommended"; static const String UPLOAD_URL = "/uploads/"; static const String TOKEN = "DBtoken"; }
0
mirrored_repositories/Flutter-Delivery-App/lib
mirrored_repositories/Flutter-Delivery-App/lib/utils/colors.dart
import 'dart:ui'; class AppColors{ static final Color textColor = const Color(0xFFccc7c5); static final Color mainColor = const Color(0xFF89dad0); static final Color iconColor1 = const Color(0xFFffd28d); static final Color iconColor2 = const Color(0xFFfcab88); static final Color paraColor = const Color(0xFF8f837f); static final Color buttonBackgroundColor = const Color(0xFFf7f6f4); static final Color SignColor = const Color(0xFFa9a29f); static final Color titleColor = const Color(0xFF5c524f); static final Color mainBlackColor = const Color(0xFF332d2d); static final Color yellowColor = const Color(0xFFffd379); }
0
mirrored_repositories/Flutter-Delivery-App/lib
mirrored_repositories/Flutter-Delivery-App/lib/utils/dimensions.dart
// ignore_for_file: unused_import import 'package:get/get.dart'; class Dimensions{ static double screenHeight = Get.context!.height; static double screenWidth = Get.context!.width; static double pageView = screenHeight/2.64; static double pageViewContainer = screenHeight/3.84; static double pageViewTextContainer = screenHeight/7.03; //dynamic height padding and margin static double height10 = screenHeight/84.4; static double height15 = screenHeight/56.27; static double height20 = screenHeight/42.2; static double height30 = screenHeight/28.13; static double height45 = screenHeight/18.76; //dynamic width padding and margin static double width10 = screenHeight/84.4; static double width15 = screenHeight/56.27; static double width20 = screenHeight/42.2; static double width30 = screenHeight/28.13; // font size static double font16 = screenHeight/52.75; static double font20 = screenHeight/42.2; static double font26 = screenHeight/32.46; //radius static double radius15 = screenHeight/56.27; static double radius20 = screenHeight/42.2; static double radius30 = screenHeight/28.13; //icon size static double iconSize24 = screenHeight/35.17; static double iconSize16 = screenHeight/52.75; //list view icon static double listViewImgSize = screenWidth/ 3.25; static double listViewTextContSize = screenWidth/3.9; //popular food static double popularFoodImgSize = screenHeight/2.41; //bottom height static double bottomHeightBar = screenHeight/7.03; }
0
mirrored_repositories/Flutter-Delivery-App
mirrored_repositories/Flutter-Delivery-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:meli_melo/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/instagram-ui-android
mirrored_repositories/instagram-ui-android/lib/data.dart
class Data { var mydetails = { 'username': '_steve', 'name': 'Steve', 'bio': 'Husband. Father. Photographer. Traveller', 'image': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', }; var stories = [ { 'username': '', 'name': '', 'bio': '', 'image': '', }, { 'username': 'tobysteel', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1629233795924-59f9b058404a?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', }, { 'username': 'johnny_krass', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1629418713613-3913dfdceaeb?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', }, { 'username': 'markruff', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1593793579677-0e800dc10b18?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1947&q=80', }, { 'username': 'rxfecxmeron', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1525609004556-c46c7d6cf023?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=389&q=80', }, { 'username': 'jessse', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1530032119742-a039e1e93265?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', }, { 'username': 'alicexo', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1629201781947-ea29e7314aa2?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', }, { 'username': '_allie_', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1622495807816-cf8eb58f9c2a?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', }, { 'username': 'hxrley', 'name': '', 'bio': '', 'image': 'https://images.unsplash.com/photo-1617802757500-f34db2339a70?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', }, ]; var posts = [ { 'profileImage': 'https://images.unsplash.com/photo-1629201781947-ea29e7314aa2?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', 'username': 'alicexo', 'name': '', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1551632811-561732d1e306?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'caption': 'To walk in nature is to witness a thousand miracles.', 'likes': '137 likes', 'comments': 'View all 12 comments', 'time': '39 minutes ago', '': '', }, { 'profileImage': 'https://images.unsplash.com/photo-1530032119742-a039e1e93265?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', 'username': 'jessse', 'name': '', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1614699207837-58360fdad507?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', 'caption': 'The cars we drive say a lot about us.', 'likes': '99 likes', 'comments': 'View all 5 comments', 'time': '56 minutes ago', '': '', }, { 'profileImage': 'https://images.unsplash.com/photo-1629418713613-3913dfdceaeb?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', 'username': 'johnny_krass', 'name': '', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1629460244940-1fc26ea27a33?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', 'caption': 'Follow the sun, wherever it leads.', 'likes': '57 likes', 'comments': 'View all 18 comments', 'time': '2 hours ago', '': '', }, ]; var highlights = [ { 'name': '❤️', 'image': 'https://images.unsplash.com/photo-1545652985-5edd365b12eb?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', }, { 'name': '📸', 'image': 'https://images.unsplash.com/photo-1586787330731-ae2476295ef6?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mjl8fGNoZXNzfGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', }, { 'name': '🏆', 'image': 'https://i.ibb.co/dK22c3M/medal.png', }, ]; var uploads = [ { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1519681393784-d120267933ba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'caption': 'I take a lot of pride in being myself. I\’m comfortable with who I am', 'likes': '157 likes', 'comments': 'View all 18 comments', 'time': '9 February', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1455729552865-3658a5d39692?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'caption': 'Clever as a devil, twice as pretty', 'likes': '100 likes', 'comments': 'View all 5 comments', 'time': '19 February', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1526666424717-ee515eb594e4?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8cGFyYWdsaWRpbmd8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'caption': 'I DON\'T HAVE TO ATTEND EVERY ARGUMENT I\'M INVITED TO', 'likes': '170 likes', 'comments': 'View all 10 comments', 'time': '29 February', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1596974341452-b92f112d8a2b?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTJ8fHJoaW5vY2Vyb3N8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'caption': 'Never stop doing great just because someone doesn\’t give you credit', 'likes': '160 likes', 'comments': 'View all 20 comments', 'time': '3 March', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1515541324332-7dd0c37426e0?ixid=MnwxMjA3fDB8MHxzZWFyY2h8N3x8d2F0ZXIlMjBzcG9ydHN8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'do more of what makes you happy', 'likes': '145 likes', 'comments': 'View all 17 comments', 'time': '13 March', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1559700488-2c5c100110f4?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8d2F0ZXIlMjBzcG9ydHN8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'I fell in love with the world in you', 'likes': '140 likes', 'comments': 'View all 27 comments', 'time': '20 March', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1495231916356-a86217efff12?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=376&q=80', 'caption': 'Self love is the best love', 'likes': '156 likes', 'comments': 'View all 7 comments', 'time': '23 March', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1558271736-cd043ef2e855?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8dmVuaWNlfGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'LOOK FOR OPPORTUNITIES...NOT GUARANTEES', 'likes': '106 likes', 'comments': 'View all 8 comments', 'time': '30 March', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1512299643965-14849b46c71a?ixid=MnwxMjA3fDB8MHxzZWFyY2h8OHx8Y29sb3VyJTIwaG91c2VzfGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'Always remember that you\'re unique. Just like everyone else', 'likes': '126 likes', 'comments': 'View all 17 comments', 'time': '3 April', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1569180880150-df4eed93c90b?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8bWFya2V0fGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'Why chase you, when I am the catch!', 'likes': '186 likes', 'comments': 'View all 17 comments', 'time': '13 April', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1509824227185-9c5a01ceba0d?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NXx8Y3Jvd2R8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'As beautiful on the inside as I am on the outside', 'likes': '163 likes', 'comments': 'View all 20 comments', 'time': '17 April', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1514525253161-7a46d19cd819?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8Y29uY2VydHxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'All about the vibe', 'likes': '250 likes', 'comments': 'View all 52 comments', 'time': '19 April', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1522312346375-d1a52e2b99b3?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8d2F0Y2h8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'People say nothing is impossible, but I do nothing every day', 'likes': '203 likes', 'comments': 'View all 12 comments', 'time': '26 April', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1517016006573-2eefaa2f5b63?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NXx8c3VtbWVyfGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'WE OFTEN FEAR THE THING WE WANT THE MOST', 'likes': '145 likes', 'comments': 'View all 18 comments', 'time': '1 May', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1483921020237-2ff51e8e4b22?ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8c25vd3xlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'If I were you, I would adore me', 'likes': '107 likes', 'comments': 'View all 4 comments', 'time': '4 May', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1559825481-12a05cc00344?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8b2NlYW58ZW58MHx8MHx8&auto=format&fit=crop&w=1000&q=60', 'caption': 'It always seems impossible until it\’s done', 'likes': '177 likes', 'comments': 'View all 34 comments', 'time': '14 May', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1581500274180-6331eea8b184?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8bWlsa3l3YXl8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'I\'m not shy, I\'m holding back my awesomeness so I don\'t intimidate you', 'likes': '77 likes', 'comments': 'View all 14 comments', 'time': '20 May', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1527684651001-731c474bbb5a?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dHJhaW58ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'Today\’s perfect', 'likes': '134 likes', 'comments': 'View all 4 comments', 'time': '25 May', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1467649165350-bdae46d9779b?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8cm9hZHN8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'Grow through what you go through', 'likes': '145 likes', 'comments': 'View all 24 comments', 'time': '4 June', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1609220136736-443140cffec6?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8ZmFtaWx5fGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'Your laugh has this incredible way of making me happy', 'likes': '122 likes', 'comments': 'View all 18 comments', 'time': '8 June', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1489011397388-494518edf378?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8a2l0ZXxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'THE BEST WAY TO ESCAPE YOUR PROBLEM IS TO SOLVE IT', 'likes': '55 likes', 'comments': 'View all 8 comments', 'time': '12 June', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1494548162494-384bba4ab999?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8c3Vuc2V0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=1000&q=60', 'caption': 'I didn\'t know we were making memories', 'likes': '300 likes', 'comments': 'View all 48 comments', 'time': '20 June', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1545243424-0ce743321e11?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8bWlsa3l3YXl8ZW58MHx8MHx8&auto=format&fit=crop&w=1000&q=60', 'caption': 'In travel mode. Do not disturb', 'likes': '250 likes', 'comments': 'View all 40 comments', 'time': '25 June', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1554238201-df3f1cf5fed7?ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8cm9hZHN8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'You can\’t live a full life on an empty stomach', 'likes': '123 likes', 'comments': 'View all 25 comments', 'time': '30 June', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1519802772250-a52a9af0eacb?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTB8fGhvbGl8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'We travel not to escape life, but for life not to escape us', 'likes': '103 likes', 'comments': 'View all 15 comments', 'time': '7 July', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1500462918059-b1a0cb512f1d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NXx8aG9saXxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=1000&q=60', 'caption': 'We\'re limited edition', 'likes': '133 likes', 'comments': 'View all 26 comments', 'time': '12 July', }, { 'profileImage': 'https://images.unsplash.com/photo-1600657644140-aa5b5e003829?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'username': '_steve', 'name': 'Steve', 'bio': '', 'postImage': 'https://images.unsplash.com/photo-1508995476428-43d70c3d0042?ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8aGFsbG93ZWVufGVufDB8fDB8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=60', 'caption': 'Getting my pose on!', 'likes': '123 likes', 'comments': 'View all 21 comments', 'time': '16 July', }, ]; var tags = [ 'https://images.unsplash.com/photo-1444210971048-6130cf0c46cf?ixid=MnwxMjA3fDB8MHxzZWFyY2h8OXx8ZnJpZW5kc3xlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', ]; var messages = [ { 'name': 'Jane Doe', 'message': 'Sent 1h ago', 'image': 'https://images.unsplash.com/photo-1604004555489-723a93d6ce74?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', }, { 'name': 'Josh', 'message': 'Seen 1h ago', 'image': 'https://images.unsplash.com/photo-1567784177951-6fa58317e16b?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MjZ8fG1hbnxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', }, ]; var searchimages = [ 'https://images.unsplash.com/photo-1628191081698-44f573462a03?ixid=MnwxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwxfHx8ZW58MHx8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631557926142-73e518301959?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyfHx8ZW58MHx8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631489709820-7eff1e3e43fb?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxOXx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631521228516-3bc7e2b66b60?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyM3x8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631414833461-c4a0e70afe54?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyNHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631521753137-c08c538b58b2?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyMXx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631534295489-9584a5efa6a8?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzMXx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631347143880-cf65b5060042?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyNnx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631508460548-c0d61a63be36?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyOXx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631519001327-574c1b0187a4?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzMnx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631492210765-6e6b20147777?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzOXx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631517412785-d533902d6a36?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzNXx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631541647718-e7589282cc57?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw0NHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631400315975-28cbd363eba2?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw0MHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1628939824352-baa1cdddeb6b?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=375&q=80', 'https://images.unsplash.com/photo-1596171428701-3fca2768f81c?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDh8NnNNVmpUTFNrZVF8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631285293016-cd0097f1e39e?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDF8cm5TS0RId3dZVWt8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1504890231393-71b0d15a05f4?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDF8NnNNVmpUTFNrZVF8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631457359574-da3b6ca75a85?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw0OHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1620167972495-b6b7bdf32c5a?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDh8dG93SlpGc2twR2d8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1630904435308-8a6a460fc614?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80', 'https://images.unsplash.com/photo-1631476565716-6f81491c0e1c?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDF8cVBZc0R6dkpPWWN8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631542759426-6660d16c13e0?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDZ8eGpQUjRobGtCR0F8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1549656136-dcdcaeecddc5?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDF8eEh4WVRNSExnT2N8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1631312708071-0f26a9b94e70?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDR8eEh4WVRNSExnT2N8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1625153547303-1523fbf985a3?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDR8UzRNS0xBc0JCNzR8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1614747233989-27c1c7f51d03?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDF8X2hiLWRsNFEtNFV8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1594708767771-a7502209ff51?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDZ8QkpKTXR0ZURKQTR8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1626318305863-bb23d0297c0b?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDN8dG93SlpGc2twR2d8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', 'https://images.unsplash.com/photo-1583887785428-b8ca627eb313?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTZ8fGJpa2luaXxlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60', ]; }
0
mirrored_repositories/instagram-ui-android
mirrored_repositories/instagram-ui-android/lib/main.dart
import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import './screens/messages/message.dart'; import './screens/homescreen/homescreen.dart'; import './screens/user_account/user_account.dart'; import './screens/search/search.dart'; import './screens/login/login.dart'; import '/components/bottomappbar.dart'; import './data.dart'; void main() { runApp(Instagram()); } class Instagram extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, routes: { MyApp.routeName: (context) => MyApp(), UserAccount.routeName: (context) => UserAccount(), SearchScreen.routeName: (context) => SearchScreen(), }, theme: ThemeData( primarySwatch: Colors.blue, backgroundColor: Colors.black, ), home: Login(), ); } } class MyApp extends StatefulWidget { static const routeName = '/my-app'; @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { PageController controller = PageController( initialPage: 0, ); @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return PageView( scrollDirection: Axis.horizontal, controller: controller, children: [ Scaffold( backgroundColor: Theme.of(context).backgroundColor, appBar: AppBar( automaticallyImplyLeading: false, backgroundColor: Theme.of(context).backgroundColor, title: const Text( 'Instagram', style: TextStyle( fontFamily: 'Instagram', fontSize: 28, color: Color.fromRGBO(252, 252, 252, 1), ), ), actions: [ Container( height: 24, width: 24, decoration: BoxDecoration( color: Theme.of(context).backgroundColor, image: DecorationImage( image: AssetImage('assets/images/upload.png'), fit: BoxFit.contain, ), ), ), const SizedBox( width: 20, ), InkWell( onTap: () { controller.jumpToPage(1); }, child: Container( height: 24, width: 24, decoration: BoxDecoration( color: Theme.of(context).backgroundColor, image: DecorationImage( image: AssetImage('assets/images/message.png'), fit: BoxFit.contain, ), ), ), ), const SizedBox( width: 10, ), ], ), body: HomeScreen(), bottomNavigationBar: const BottomAppBarWidget(), ), MessengerScreen(controller), ], ); } }
0
mirrored_repositories/instagram-ui-android/lib
mirrored_repositories/instagram-ui-android/lib/components/searchbar.dart
import 'package:flutter/material.dart'; class SearchBar extends StatelessWidget { Color color; SearchBar(this.color); @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.symmetric(horizontal: 10), width: MediaQuery.of(context).size.width, height: 40, decoration: BoxDecoration( color: Color.fromRGBO(38, 38, 38, 1), borderRadius: BorderRadius.circular(10), ), child: Row( children: [ Container( padding: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: Icon( Icons.search, // color: Color.fromRGBO(170, 170, 170, 1), color: color, size: 18, ), ), Container( padding: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: const Text( 'Search', style: TextStyle( fontSize: 18, letterSpacing: 1, fontFamily: 'FreeSans', color: Color.fromRGBO(170, 170, 170, 1), ), ), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib
mirrored_repositories/instagram-ui-android/lib/components/post_card.dart
import 'package:flutter/material.dart'; import '../screens/homescreen/widgets/header.dart'; import '../screens/homescreen/widgets/footer.dart'; class Post extends StatelessWidget { var val; Post(this.val); @override Widget build(BuildContext context) { return Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ PostHeader(val), Container( width: MediaQuery.of(context).size.width, height: 400, decoration: BoxDecoration( image: DecorationImage( image: NetworkImage( val['postImage'].toString(), ), fit: BoxFit.fitHeight, ), ), ), PostFooter(), Padding( padding: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: Text( val['likes'].toString(), style: TextStyle( color: Color.fromRGBO(235, 235, 235, 1), fontSize: 15, fontWeight: FontWeight.bold, fontFamily: 'FreeSansBold', ), textAlign: TextAlign.start, ), ), Padding( padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), child: RichText( text: TextSpan( children: [ TextSpan( text: '${val['username'].toString()} ', style: TextStyle( color: Color.fromRGBO(225, 225, 225, 1), fontSize: 15, fontFamily: 'FreeSansBold', fontWeight: FontWeight.bold, ), ), TextSpan( text: val['caption'].toString(), style: TextStyle( color: Color.fromRGBO(225, 225, 225, 1), fontSize: 15, fontFamily: 'FreeSans', ), ), ], ), ), ), Padding( padding: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: Text( val['comments'].toString(), style: TextStyle( color: Color.fromRGBO(152, 152, 152, 1), fontSize: 15, fontFamily: 'FreeSans', ), textAlign: TextAlign.start, ), ), Padding( padding: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: Text( val['time'].toString(), style: TextStyle( fontFamily: 'FreeSans', color: Color.fromRGBO(152, 152, 152, 1), fontSize: 11, ), textAlign: TextAlign.start, ), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib
mirrored_repositories/instagram-ui-android/lib/components/bottomappbar.dart
import 'package:flutter/material.dart'; import '/main.dart'; import '/screens/user_account/user_account.dart'; import '/screens/search/search.dart'; import '/data.dart'; class BottomAppBarWidget extends StatelessWidget { const BottomAppBarWidget({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return BottomAppBar( color: Colors.black, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ GestureDetector( onTap: () { Navigator.of(context).pushNamed(MyApp.routeName); }, child: Container( height: 50, child: const Icon( Icons.home, color: Color.fromRGBO(249, 249, 249, 1), size: 30, ), ), ), GestureDetector( onTap: () { Navigator.of(context).pushNamed(SearchScreen.routeName); }, child: Container( height: 50, child: const Icon( Icons.search, color: Color.fromRGBO(249, 249, 249, 1), size: 30, ), ), ), GestureDetector( onTap: () {}, child: Container( height: 26, width: 26, decoration: BoxDecoration( color: Theme.of(context).backgroundColor, image: DecorationImage( image: AssetImage('assets/images/reel.png'), fit: BoxFit.contain, ), ), ), ), GestureDetector( onTap: () {}, child: Container( height: 50, child: const Icon( Icons.favorite_border_outlined, color: Color.fromRGBO(249, 249, 249, 1), size: 30, ), ), ), GestureDetector( onTap: () { Navigator.of(context).pushNamed(UserAccount.routeName); }, child: CircleAvatar( radius: 15, backgroundImage: NetworkImage( Data().mydetails['image'].toString(), ), ), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens
mirrored_repositories/instagram-ui-android/lib/screens/post/post.dart
import 'package:flutter/material.dart'; import '../../data.dart'; import '../../components/post_card.dart'; import '../../components/bottomappbar.dart'; import './widgets/appbar.dart'; class PostScreen extends StatelessWidget { PostScreen({Key? key, this.index = 0}) : super(key: key); int index; static const routeName = "/post-screen"; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Theme.of(context).backgroundColor, appBar: getAppBar(context), body: Post(Data().uploads[index]), bottomNavigationBar: BottomAppBarWidget(), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/post
mirrored_repositories/instagram-ui-android/lib/screens/post/widgets/appbar.dart
import 'package:flutter/material.dart'; AppBar getAppBar(BuildContext context) { return AppBar( backgroundColor: Theme.of(context).backgroundColor, title: Text( "Post", style: TextStyle( fontSize: 24, fontFamily: 'FreeSans', fontWeight: FontWeight.w500, ), ), ); }
0
mirrored_repositories/instagram-ui-android/lib/screens
mirrored_repositories/instagram-ui-android/lib/screens/login/login.dart
import 'package:flutter/material.dart'; import './widgets/bottomButtons.dart'; import './widgets/accounts.dart'; class Login extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: ListView( children: [ const Text( 'Instagram', style: TextStyle( color: Color.fromRGBO(248, 248, 248, 1), fontFamily: 'Instagram', fontSize: 40, ), textAlign: TextAlign.center, ), Account(), SizedBox( height: MediaQuery.of(context).size.height - 50 - 52 - 40 - MediaQuery.of(context).padding.top - MediaQuery.of(context).padding.bottom, ), Row( children: [ getBoxes( context, Border( top: BorderSide( color: Color.fromRGBO(39, 39, 39, 1), width: 1), right: BorderSide( color: Color.fromRGBO(39, 39, 39, 1), width: 1), ), 'Switch accounts', ), getBoxes( context, Border( top: BorderSide( color: Color.fromRGBO(39, 39, 39, 1), width: 1), left: BorderSide( color: Color.fromRGBO(39, 39, 39, 1), width: 1), ), 'Sign Up', ), ], ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/login
mirrored_repositories/instagram-ui-android/lib/screens/login/widgets/bottomButtons.dart
import 'package:flutter/material.dart'; Container getBoxes(BuildContext context, Border border, String text) { return Container( width: MediaQuery.of(context).size.width / 2, height: 50, decoration: BoxDecoration( border: border, ), child: Align( alignment: Alignment.center, child: Text( text, style: TextStyle( color: Color.fromRGBO(40, 147, 219, 1), fontSize: 15, fontFamily: 'FreeSans', ), ), ), ); }
0
mirrored_repositories/instagram-ui-android/lib/screens/login
mirrored_repositories/instagram-ui-android/lib/screens/login/widgets/accounts.dart
import 'package:flutter/material.dart'; import '../../../data.dart'; import '../../../main.dart'; class Account extends StatelessWidget { @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.fromLTRB(10, 0, 10, 0), child: Row( children: [ CircleAvatar( radius: 20, backgroundImage: NetworkImage( Data().mydetails['image'].toString(), ), ), const SizedBox(width: 10), Text( Data().mydetails['username'].toString(), style: TextStyle( color: Color.fromRGBO(248, 248, 248, 1), fontFamily: 'FreeSans', fontSize: 15, ), ), const Spacer(), GestureDetector( onTap: () { Navigator.of(context).pushReplacement( MaterialPageRoute( builder: (context) => MyApp(), ), ); }, child: Container( decoration: BoxDecoration( border: Border.all( color: Color.fromRGBO(210, 210, 210, 1), width: 1, ), borderRadius: BorderRadius.circular(5), ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), child: Text( 'Log in', style: TextStyle( color: Color.fromRGBO(248, 248, 248, 1), fontSize: 15, fontWeight: FontWeight.bold, fontFamily: 'FreeSansBold', ), ), ), ), ), const SizedBox(width: 10), const Icon( Icons.more_vert, size: 20, color: Color.fromRGBO(158, 158, 158, 1), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens
mirrored_repositories/instagram-ui-android/lib/screens/user_account/functions.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../../data.dart'; AppBar getAppBar(BuildContext context) { return AppBar( automaticallyImplyLeading: false, backgroundColor: Theme.of(context).backgroundColor, title: Row( children: [ const Icon( FontAwesomeIcons.lock, size: 18, ), const SizedBox(width: 10), Text( Data().mydetails['username'].toString(), style: const TextStyle( fontSize: 24, letterSpacing: 1, color: Color.fromRGBO(252, 252, 252, 1), ), ), const SizedBox(width: 8), const Icon( Icons.keyboard_arrow_down_rounded, ), ], ), actions: [ Container( height: 24, width: 24, decoration: BoxDecoration( color: Theme.of(context).backgroundColor, image: const DecorationImage( image: AssetImage('assets/images/upload.png'), fit: BoxFit.contain, ), ), ), const SizedBox( width: 20, ), Container( height: 22, width: 22, decoration: BoxDecoration( color: Theme.of(context).backgroundColor, image: const DecorationImage( image: AssetImage('assets/images/lines.jpg'), fit: BoxFit.contain, ), ), ), const SizedBox( width: 10, ), ], ); } Container getStatsCard(String num, String text) { return Container( height: 100, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( num, style: const TextStyle( color: Color.fromRGBO(244, 244, 244, 1), fontWeight: FontWeight.bold, fontFamily: 'FreeSansBold', fontSize: 20, ), ), Text( text, style: const TextStyle( color: Color.fromRGBO(244, 244, 244, 1), fontFamily: 'FreeSans', ), ), ], ), ); } Row getHighlights() { return Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ ...Data().highlights.map((e) { return Container( margin: const EdgeInsets.fromLTRB(5, 10, 5, 0), height: 120, width: 75, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( height: 75, width: 75, child: Align( alignment: Alignment.center, child: Stack( children: [ const Align( alignment: Alignment.center, child: CircleAvatar( backgroundColor: Color.fromRGBO(102, 102, 102, 1), radius: 35, ), ), const Align( alignment: Alignment.center, child: CircleAvatar( backgroundColor: Colors.black, radius: 34, ), ), Align( alignment: Alignment.center, child: CircleAvatar( backgroundColor: Colors.black, backgroundImage: NetworkImage( e['image'].toString(), ), radius: 30, ), ) ], ), ), ), const SizedBox(height: 5), Text( e['name'].toString(), textAlign: TextAlign.center, style: const TextStyle( fontSize: 16, fontFamily: 'FreeSans', ), ) ], ), ); }).toList(), Container( margin: const EdgeInsets.fromLTRB(5, 10, 5, 0), height: 120, width: 75, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( height: 75, width: 75, child: Align( alignment: Alignment.center, child: Stack( children: [ const Align( alignment: Alignment.center, child: CircleAvatar( backgroundColor: Color.fromRGBO(197, 197, 197, 1), radius: 35, ), ), const Align( alignment: Alignment.center, child: CircleAvatar( backgroundColor: Colors.black, radius: 34, ), ), const Align( alignment: Alignment.center, child: CircleAvatar( backgroundColor: Colors.black, child: Icon( Icons.add, size: 35, color: Colors.white, ), radius: 30, ), ) ], ), ), ), const SizedBox(height: 5), const Text( 'New', textAlign: TextAlign.center, style: TextStyle( fontSize: 16, color: Colors.white, fontFamily: 'FreeSans', ), ) ], ), ), ], ); } Row getEditProfileButton(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ GestureDetector( onTap: () {}, child: Container( margin: EdgeInsets.fromLTRB(10, 10, 0, 0), height: 35, width: MediaQuery.of(context).size.width - 60, decoration: BoxDecoration( border: Border.all( color: Color.fromRGBO(87, 87, 87, 1), width: 1, ), borderRadius: BorderRadius.circular(5), ), child: const Align( alignment: Alignment.center, child: Text( 'Edit Profile', style: TextStyle( color: Colors.white, fontFamily: 'FreeSans', fontSize: 15, ), ), ), ), ), GestureDetector( onTap: () {}, child: Container( margin: EdgeInsets.fromLTRB(10, 10, 0, 0), height: 35, width: 35, decoration: BoxDecoration( border: Border.all( color: Color.fromRGBO(87, 87, 87, 1), width: 1, ), borderRadius: BorderRadius.circular(5), ), child: const Align( alignment: Alignment.center, child: Icon( Icons.keyboard_arrow_down, color: Colors.white, size: 20, ), ), ), ), ], ); }
0
mirrored_repositories/instagram-ui-android/lib/screens
mirrored_repositories/instagram-ui-android/lib/screens/user_account/user_account.dart
import 'package:flutter/material.dart'; import './widgets/tabview.dart'; import '/components/bottomappbar.dart'; import 'functions.dart'; import '../../data.dart'; class UserAccount extends StatelessWidget { static const routeName = '/useraccount'; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Theme.of(context).backgroundColor, appBar: getAppBar(context), body: CustomScrollView( physics: ScrollPhysics(), slivers: [ SliverToBoxAdapter(child: SizedBox(height: 10)), SliverToBoxAdapter( child: Container( padding: EdgeInsets.fromLTRB(10, 0, 30, 0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ CircleAvatar( backgroundImage: NetworkImage( Data().mydetails['image'].toString(), ), radius: 50, ), getStatsCard(Data().uploads.length.toString(), 'Posts'), getStatsCard('199', 'Followers'), getStatsCard('222', 'Following'), ], ), ), ), SliverToBoxAdapter(child: const SizedBox(height: 10)), SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), child: Text( Data().mydetails['name'].toString(), style: TextStyle( color: Color.fromRGBO(244, 244, 244, 1), fontFamily: 'FreeSans', fontSize: 15, ), ), ), ), SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), child: Text( Data().mydetails['bio'].toString(), style: TextStyle( color: Color.fromRGBO(244, 244, 244, 1), fontFamily: 'FreeSans', fontSize: 15, ), ), ), ), SliverToBoxAdapter(child: getEditProfileButton(context)), SliverToBoxAdapter(child: getHighlights()), getTabBar(), ], ), bottomNavigationBar: const BottomAppBarWidget(), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/user_account
mirrored_repositories/instagram-ui-android/lib/screens/user_account/widgets/uploads.dart
import 'package:flutter/material.dart'; import '../../post/post.dart'; import '../../../data.dart'; class Uploads extends StatelessWidget { @override Widget build(BuildContext context) { return SliverGrid( delegate: SliverChildBuilderDelegate( (ctx, index) { return GestureDetector( onTap: () { Navigator.of(context).push( MaterialPageRoute( builder: (context) => PostScreen(index: index), ), ); }, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.black, ), image: DecorationImage( image: NetworkImage( Data().uploads[index]["postImage"].toString()), fit: BoxFit.cover, ), color: Colors.black, ), ), ); }, childCount: Data().uploads.length, ), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, childAspectRatio: 1, ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/user_account
mirrored_repositories/instagram-ui-android/lib/screens/user_account/widgets/tags.dart
import 'package:flutter/material.dart'; import '../../../data.dart'; class Tags extends StatelessWidget { @override Widget build(BuildContext context) { return SliverGrid( delegate: SliverChildBuilderDelegate( (ctx, index) { return Container( decoration: BoxDecoration( border: Border.all( color: Colors.black, ), image: DecorationImage( image: NetworkImage(Data().tags[index]), fit: BoxFit.contain, ), color: Colors.black, ), ); }, childCount: Data().tags.length, ), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, childAspectRatio: 1, ), ); // return GridView.builder( // physics: const ScrollPhysics(), // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( // crossAxisCount: 3, // childAspectRatio: 1, // ), // itemCount: Data().tags.length, // itemBuilder: (ctx, index) { // return Container( // decoration: BoxDecoration( // border: Border.all( // color: Colors.black, // ), // image: DecorationImage( // image: NetworkImage(Data().tags[index]), // fit: BoxFit.contain, // ), // color: Colors.black, // ), // ); // }, // ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/user_account
mirrored_repositories/instagram-ui-android/lib/screens/user_account/widgets/tabview.dart
import 'package:flutter/material.dart'; import 'package:sliver_tools/sliver_tools.dart'; import './tags.dart'; import './uploads.dart'; // the tab view on the profile page // the posted image grid and the tagged posts grid class getTabBar extends StatefulWidget { @override State<getTabBar> createState() => _getTabBarState(); } class _getTabBarState extends State<getTabBar> { int index = 0; @override Widget build(BuildContext context) { return MultiSliver( children: [ SliverPinnedHeader( child: Container( color: Colors.black, padding: const EdgeInsets.symmetric(vertical: 10), child: Row( children: [ Expanded( child: InkWell( onTap: () { setState(() { index = 0; }); }, child: Center( child: Icon( Icons.apps_outlined, color: Colors.white, ), ), ), ), Expanded( child: InkWell( onTap: () { setState(() { index = 1; }); }, child: Center( child: Icon( Icons.account_box_outlined, color: Colors.white, ), ), ), ), ], ), ), ), index == 0 ? Uploads() : Tags(), ], ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens
mirrored_repositories/instagram-ui-android/lib/screens/messages/message.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../../components/searchbar.dart'; import '/screens/messages/widgets/tabcards.dart'; import '/screens/messages/widgets/messagescard.dart'; import '/screens/messages/widgets/roomscard.dart'; import '/data.dart'; class MessengerScreen extends StatefulWidget { PageController controller; MessengerScreen(this.controller); @override State<MessengerScreen> createState() => _MessengerScreenState(); } class _MessengerScreenState extends State<MessengerScreen> { int index = 0; var screens = [ MessagesCard(), RoomsCard(), Container(), ]; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( backgroundColor: Colors.black, leading: IconButton( onPressed: () { widget.controller.jumpToPage(0); }, icon: const Icon( Icons.arrow_back_sharp, color: Colors.white, ), ), title: Row( children: [ Text( Data().mydetails['username'].toString(), style: const TextStyle( fontSize: 26, fontWeight: FontWeight.bold, letterSpacing: 1, color: Color.fromRGBO(252, 252, 252, 1), ), ), const Icon( Icons.keyboard_arrow_down, color: Colors.white, ), ], ), actions: [ Container( height: 50, width: 100, decoration: const BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/actionbutton.jpg'), fit: BoxFit.cover, ), ), ), ], ), body: SingleChildScrollView( child: Column( children: [ index == 0 ? Center( child: SearchBar( Color.fromRGBO(170, 170, 170, 1), ), ) : Container(), Container( height: 50, width: double.infinity, child: Row( children: [ Flexible( child: InkWell( onTap: () { setState(() { index = 0; }); }, child: TabCard(index, 'Chats', 0))), Flexible( child: InkWell( onTap: () { setState(() { index = 1; }); }, child: TabCard(index, 'Rooms', 1))), Flexible( child: InkWell( onTap: () {}, child: TabCard(index, '0 requests', 2))), ], ), ), screens[index], ], ), ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/messages
mirrored_repositories/instagram-ui-android/lib/screens/messages/widgets/tabcards.dart
import 'package:flutter/material.dart'; class TabCard extends StatelessWidget { int number, index; String text; TabCard(this.number, this.text, this.index); @override Widget build(BuildContext context) { return Stack( children: [ Container(color: index == number ? Colors.white : Colors.black), Container( height: 49, decoration: const BoxDecoration( color: Colors.black, ), child: Center( child: Text( text, style: TextStyle( color: Colors.white, fontFamily: 'FreeSans', ), ), ), ), ], ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/messages
mirrored_repositories/instagram-ui-android/lib/screens/messages/widgets/messagescard.dart
import 'package:flutter/material.dart'; import '/data.dart'; class MessagesCard extends StatelessWidget { @override Widget build(BuildContext context) { return SingleChildScrollView( physics: const ScrollPhysics(), child: Column( children: [ Container( padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 5), margin: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ ...Data().messages.map( (ele) { return Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( height: 70, width: 65, child: Stack( alignment: Alignment.center, children: [ Align( alignment: Alignment.center, child: Container( width: 59, decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.black, ), ), ), Align( alignment: Alignment.center, child: Container( width: 56, decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: NetworkImage(ele['image'].toString()), fit: BoxFit.cover, ), ), ), ), ], ), ), const SizedBox(width: 10), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( ele['name'].toString(), style: TextStyle( color: Color.fromRGBO(222, 222, 222, 1), fontFamily: 'FreeSans', ), ), Text( ele['message'].toString(), style: TextStyle( color: Color.fromRGBO(147, 147, 147, 1), fontFamily: 'FreeSans', ), ), ], ), const Spacer(), Container( margin: EdgeInsets.fromLTRB(0, 0, 15, 0), height: 20, width: 20, decoration: const BoxDecoration( image: const DecorationImage( image: AssetImage('assets/images/camera.jpg'), fit: BoxFit.cover, ), ), ), ], ); }, ).toList(), ], ), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/messages
mirrored_repositories/instagram-ui-android/lib/screens/messages/widgets/roomscard.dart
import 'package:flutter/material.dart'; class RoomsCard extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: Column( children: [ const SizedBox(height: 20), Container( height: 150, width: 150, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/noroom.jpg'), fit: BoxFit.contain, ), ), ), const Text( 'Video chat with anyone', style: TextStyle( fontWeight: FontWeight.bold, color: Colors.white, fontFamily: 'FreeSans', fontSize: 25, ), ), const SizedBox(height: 20), const Text( 'Share a link to invite anyone to video', style: TextStyle( color: Color.fromRGBO(121, 121, 121, 1), fontSize: 15, ), ), const Text( 'chat, even if they don\'t have Instagram.', style: TextStyle( color: Color.fromRGBO(121, 121, 121, 1), fontSize: 15, ), ), const SizedBox(height: 20), const Text( 'Create Room', style: TextStyle( color: Color.fromRGBO(49, 129, 190, 1), fontSize: 15, fontFamily: 'FreeSans', ), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens
mirrored_repositories/instagram-ui-android/lib/screens/homescreen/homescreen.dart
import 'package:flutter/material.dart'; import './widgets/story_section.dart'; import '../../components/post_card.dart'; import '../../data.dart'; class HomeScreen extends StatelessWidget { @override Widget build(BuildContext context) { return ListView( children: [ Stories(), ...Data().posts.map((val) { return Post(val); }).toList(), ], ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/homescreen
mirrored_repositories/instagram-ui-android/lib/screens/homescreen/widgets/story_card.dart
import 'package:flutter/material.dart'; class StoryCard extends StatelessWidget { var data; StoryCard(this.data); @override Widget build(BuildContext context) { return Container( width: 80, height: 100, margin: EdgeInsets.fromLTRB(10, 0, 0, 0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( height: 90, child: Stack( children: [ Align( alignment: Alignment.center, child: Container( width: 80, decoration: const BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient( begin: Alignment.topRight, end: Alignment.bottomLeft, stops: [ 0.35, 0.6, 1, ], colors: [ Color.fromRGBO(179, 43, 99, 1), Color.fromRGBO(220, 129, 126, 1), Color.fromRGBO(255, 221, 135, 1), ], ), ), ), ), Align( alignment: Alignment.center, child: Container( width: 75, decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.black, ), ), ), Align( alignment: Alignment.center, child: Container( width: 70, decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: NetworkImage(data['image']), fit: BoxFit.cover, ), ), ), ), ], ), ), Text( data['username'], softWrap: true, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontFamily: 'FreeSans', color: Color.fromRGBO(218, 218, 218, 1), fontSize: 14, ), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/homescreen
mirrored_repositories/instagram-ui-android/lib/screens/homescreen/widgets/your_story_card.dart
import 'package:flutter/material.dart'; import '../../../data.dart'; class YourStory extends StatelessWidget { @override Widget build(BuildContext context) { return Container( width: 80, height: 100, margin: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( height: 90, child: Stack( children: [ Align( alignment: Alignment.center, child: Container( width: 80, decoration: const BoxDecoration( shape: BoxShape.circle, ), ), ), Align( alignment: Alignment.center, child: Container( width: 75, decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.black, ), ), ), Align( alignment: Alignment.center, child: Container( width: 70, decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: NetworkImage(Data().mydetails['image'].toString()), fit: BoxFit.cover, ), ), ), ), const Positioned( bottom: 6, right: 5, child: CircleAvatar( radius: 12, backgroundColor: Colors.black, child: CircleAvatar( backgroundColor: Colors.blue, radius: 10, child: Icon( Icons.add, size: 15, ), ), ), ) ], ), ), const Text( 'Your story', softWrap: true, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontFamily: 'FreeSans', color: Color.fromRGBO(218, 218, 218, 1), ), ), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/homescreen
mirrored_repositories/instagram-ui-android/lib/screens/homescreen/widgets/story_section.dart
import 'package:flutter/material.dart'; import './your_story_card.dart'; import './story_card.dart'; import '../../../data.dart'; class Stories extends StatelessWidget { @override Widget build(BuildContext context) { return Container( width: MediaQuery.of(context).size.width, height: 120, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: Data().stories.length, itemBuilder: (context, index) { if (index == 0) { return YourStory(); } else { return StoryCard( Data().stories[index], ); } }, ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/homescreen
mirrored_repositories/instagram-ui-android/lib/screens/homescreen/widgets/footer.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class PostFooter extends StatelessWidget { @override Widget build(BuildContext context) { return Container( width: MediaQuery.of(context).size.width, height: 50, color: Colors.transparent, child: Row( children: [ const SizedBox(width: 10), const Icon( FontAwesomeIcons.heart, color: Colors.white, ), const SizedBox(width: 15), const Icon( FontAwesomeIcons.comment, color: Colors.white, ), const SizedBox(width: 15), const Icon( FontAwesomeIcons.paperPlane, color: Colors.white, size: 20, ), const Spacer(), const Icon( Icons.bookmark_outline, color: Colors.white, ), const SizedBox(width: 10), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens/homescreen
mirrored_repositories/instagram-ui-android/lib/screens/homescreen/widgets/header.dart
import 'package:flutter/material.dart'; class PostHeader extends StatelessWidget { var val; PostHeader(this.val); @override Widget build(BuildContext context) { return Container( width: MediaQuery.of(context).size.width, height: 50, color: Colors.transparent, child: Row( children: [ const SizedBox(width: 10), CircleAvatar( backgroundColor: Colors.transparent, radius: 15, backgroundImage: NetworkImage( val['profileImage'].toString(), ), ), const SizedBox(width: 10), Text( val['username'].toString(), style: TextStyle( color: Color.fromRGBO(252, 252, 252, 1), fontSize: 15, fontFamily: 'FreeSansBold', fontWeight: FontWeight.bold, ), ), const Spacer(), const Icon( Icons.more_vert, color: Color.fromRGBO(252, 252, 252, 1), ), const SizedBox(width: 10), ], ), ); } }
0
mirrored_repositories/instagram-ui-android/lib/screens
mirrored_repositories/instagram-ui-android/lib/screens/search/search.dart
import 'package:flutter/material.dart'; import '/components/searchbar.dart'; import '/components/bottomappbar.dart'; import '/data.dart'; class SearchScreen extends StatelessWidget { const SearchScreen({Key? key}) : super(key: key); static const routeName = '/search-screen'; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: ListView( physics: const ScrollPhysics(), padding: EdgeInsets.fromLTRB(0, MediaQuery.of(context).padding.top, 0, 0), children: [ Container( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), child: SearchBar( Colors.white, ), ), GridView.builder( padding: EdgeInsets.zero, shrinkWrap: true, physics: const ScrollPhysics(), itemCount: Data().searchimages.length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, mainAxisSpacing: 3, crossAxisSpacing: 3, ), itemBuilder: (context, index) { return Container( decoration: BoxDecoration( image: DecorationImage( image: NetworkImage( Data().searchimages[index], ), fit: BoxFit.cover, ), ), ); }, ), Padding( padding: const EdgeInsets.all(15.0), child: const Center( child: const CircularProgressIndicator( backgroundColor: Colors.white, color: Colors.black87, strokeWidth: 1, ), ), ), ], ), bottomNavigationBar: const BottomAppBarWidget(), ); } }
0
mirrored_repositories/instagram-ui-android
mirrored_repositories/instagram-ui-android/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:instagram/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/childpugh
mirrored_repositories/childpugh/lib/main.dart
import 'package:flutter/material.dart'; import 'src/childpugh_page.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: ChildPughPage(), ); } }
0
mirrored_repositories/childpugh/lib
mirrored_repositories/childpugh/lib/src/childpugh_page.dart
import 'package:flutter/material.dart'; import 'childpugh_bloc.dart'; import 'choice.dart'; class ChildPughPage extends StatefulWidget { final bloc = ChildPughBloc(); @override ChildPughPageState createState() { return ChildPughPageState(); } } class ChildPughPageState extends State<ChildPughPage> { @override void dispose() { widget.bloc.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Child-Pugh calculator'), ), body: Column( children: [ Container( margin: const EdgeInsets.only(top: 12.0, left: 6.0, right: 6.0), decoration: BoxDecoration( border: Border.all(color: Colors.grey[500], width: 4.0), ), child: ChildPughResult( bloc: widget.bloc, ), ), Expanded( child: ChildPughForm( bloc: widget.bloc, ), ), ], ), ); } } class ChildPughResult extends StatelessWidget { const ChildPughResult({Key key, this.bloc}) : super(key: key); final ChildPughBloc bloc; @override Widget build(BuildContext context) { return Container( color: Colors.white, height: 96.0, child: Row( children: <Widget>[ Expanded( child: StreamBuilder<bool>( stream: bloc.isComplete, builder: (context, snapshot) { return snapshot.hasData ? StreamBuilder<int>( stream: bloc.outResult, builder: (context, snapshot) { return snapshot.hasData ? Result(result: snapshot.data) : Container(); }) : Center( child: const Text( 'Complete the form.', style: TextStyle( fontSize: 20.0, ), ), ); }, ), ), ], ), ); } } class Result extends StatelessWidget { const Result({Key key, this.result}) : super(key: key); final int result; @override Widget build(BuildContext context) { final styleH = TextStyle( color: Colors.grey[900], fontSize: 18.0, fontStyle: FontStyle.italic, ); final styleR = TextStyle( color: Colors.indigo[800], fontSize: 20.0, fontWeight: FontWeight.w800); String res = ''; if (result == 5 || result == 6) res = 'A'; if (result >= 7 && result <= 9) res = 'B'; if (result >= 10) res = 'C'; return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Grade:', style: styleH, ), Container(width: 8.0), Text('$res', style: styleR), ], ), Container(height: 8.0), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Total points:', style: styleH, ), Container(width: 8.0), Text( '$result', style: styleR, ), ], ), ], ); } } class ChildPughForm extends StatelessWidget { const ChildPughForm({Key key, this.bloc}) : super(key: key); final ChildPughBloc bloc; @override Widget build(BuildContext context) { return Container( color: Theme.of(context).scaffoldBackgroundColor, child: ListView( shrinkWrap: true, children: [ Container( height: 12.0, ), HeaderSection(text: 'Bilirubin (mg/dL)'), ChildPughSection( inStream: bloc.inBilirubin, outStream: bloc.outBilirubin, choices: bilirubinChoices), HeaderSection(text: 'Albumin (g/dL)'), ChildPughSection( inStream: bloc.inAlbumin, outStream: bloc.outAlbumin, choices: albuminChoices), HeaderSection(text: 'INR'), ChildPughSection( inStream: bloc.inInr, outStream: bloc.outInr, choices: inrChoices), HeaderSection(text: 'Ascites'), ChildPughSection( inStream: bloc.inAscites, outStream: bloc.outAscites, choices: ascitesChoices), HeaderSection(text: 'Encephalopathy'), ChildPughSection( inStream: bloc.inEncephalopathy, outStream: bloc.outEncephalopathy, choices: encephalopathyChoices), Container( height: 12.0, ), ], ), ); } } class HeaderSection extends StatelessWidget { const HeaderSection({Key key, this.text}) : super(key: key); final String text; @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0), height: 32.0, decoration: BoxDecoration( color: Theme.of(context).primaryColor.withAlpha(200), border: Border.all( color: Colors.blueGrey[800], width: 1.0, )), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( text, style: const TextStyle( color: Colors.white, fontSize: 16.0, fontWeight: FontWeight.w500), ), ], ), ); } } class ChildPughSection extends StatelessWidget { const ChildPughSection({Key key, this.inStream, this.outStream, this.choices}) : super(key: key); final Stream outStream; final Function(Score) inStream; final List<Choice> choices; @override Widget build(BuildContext context) { return StreamBuilder<Score>( stream: outStream, builder: (context, snapshot) { return Column(children: [ for (var choice in choices) InkWell( onTap: () { // When the user taps the choice the value is sent to stream inStream(choice.score); print("${choice.text}: ${choice.score}"); }, child: Padding( padding: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 10.0), child: Row( children: [ // If the stream has the same value of the current choice // shows the checked box, otherwise the empty square snapshot.data == choice.score ? Icon(Icons.check_box) : Icon(Icons.crop_square), //To show the text of the current choice Padding( padding: const EdgeInsets.only(left: 12.0), child: Text(choice.text, style: const TextStyle( fontSize: 16.0, fontWeight: FontWeight.w400, )), ), ], ), ), ) ]); }, ); } }
0
mirrored_repositories/childpugh/lib
mirrored_repositories/childpugh/lib/src/childpugh_bloc.dart
import 'dart:async'; import 'package:rxdart/rxdart.dart'; import 'choice.dart'; class ChildPughBloc { ChildPughBloc() { print('-------CHILDPUGH BLOC INIT--------'); _isCompleteSubscription = isComplete.listen((_) { print('----CALC CHILD PUGH---'); calc(); }); } StreamSubscription _isCompleteSubscription; // BILIRUBIN (< 2mg/dL +1, 2 - 3 +2, >3 +3) final _bilirubin = BehaviorSubject<Score>(); Function(Score) get inBilirubin => _bilirubin.sink.add; Stream<Score> get outBilirubin => _bilirubin.stream; // ALBUMIN (< 2.8 g/dL +3, 2.8 - 3.5 +2, > 3.5 +1) final _albumin = BehaviorSubject<Score>(); Function(Score) get inAlbumin => _albumin.sink.add; Stream<Score> get outAlbumin => _albumin.stream; // INR (<1.7 +1, 1.7 - 2.2 +2, > 2.2 +3) final _inr = BehaviorSubject<Score>(); Function(Score) get inInr => _inr.sink.add; Stream<Score> get outInr => _inr.stream; // ASCITES (Absent +1, slight +2, moderate +3) final _ascites = BehaviorSubject<Score>(); Function(Score) get inAscites => _ascites.sink.add; Stream<Score> get outAscites => _ascites.stream; // ENCEPHALOPATHY (NO +1, Grade 1-2 +2, Grade 3-4 +3) final _encephalopathy = BehaviorSubject<Score>(); Function(Score) get inEncephalopathy => _encephalopathy.sink.add; Stream<Score> get outEncephalopathy => _encephalopathy.stream; //RESULT final _result = BehaviorSubject<int>(); Function(int) get inResult => _result.sink.add; Stream<int> get outResult => _result.stream; Stream<bool> get isComplete => Observable.combineLatest5( outBilirubin, outAlbumin, outAscites, outInr, outEncephalopathy, (a, b, c, d, e) => true); void calc() { int total = 0; // Assign only the items not null final scores = [ _bilirubin.value, _albumin.value, _inr.value, _ascites.value, _encephalopathy.value, ]; for (var value in scores) { total += scorePoints[value]; } // send the result to stream inResult(total); print('RESULT: ${_result.value}'); } void dispose() { print('---------CHILDPUGH BLOC DISPOSE-----------'); _bilirubin.close(); _albumin.close(); _inr.close(); _ascites.close(); _encephalopathy.close(); _result.close(); _isCompleteSubscription.cancel(); } }
0
mirrored_repositories/childpugh/lib
mirrored_repositories/childpugh/lib/src/choice.dart
enum Score { one, two, three } class Choice { Choice(this.text, this.score); String text; Score score; } final bilirubinChoices = [ Choice('< 2', Score.one), Choice('2 - 3', Score.two), Choice('> 3', Score.three), ]; final albuminChoices = [ Choice('> 3.5', Score.one), Choice('2.8 - 3.5', Score.two), Choice('< 2.8', Score.three), ]; final inrChoices = [ Choice('< 1.7', Score.one), Choice('1.7 - 2.3', Score.two), Choice('> 2.3', Score.three), ]; final ascitesChoices = [ Choice('Absent', Score.one), Choice('Slight', Score.two), Choice('Moderate', Score.three), ]; final encephalopathyChoices = [ Choice('Absent', Score.one), Choice('Grade 1-2', Score.two), Choice('Grade 3-4', Score.three), ]; final scorePoints = {Score.one: 1, Score.two: 2, Score.three: 3};
0
mirrored_repositories/childpugh
mirrored_repositories/childpugh/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:childpugh/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/video_example
mirrored_repositories/video_example/lib/main.dart
import 'package:flutter/material.dart'; import 'package:video_example/page/basics_page.dart'; import 'package:video_example/page/orientation_page.dart'; final urlLandscapeVideo = 'https://assets.mixkit.co/videos/preview/mixkit-group-of-friends-partying-happily-4640-large.mp4'; final urlPortraitVideo = 'https://assets.mixkit.co/videos/preview/mixkit-a-girl-blowing-a-bubble-gum-at-an-amusement-park-1226-large.mp4'; final urlYoutubeVideo = 'https://youtube.com/watch?v=HSAa9yi0OMA'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) => MaterialApp( debugShowCheckedModeBanner: false, title: 'Video Player', theme: ThemeData( primaryColor: Colors.blueAccent, scaffoldBackgroundColor: Colors.black, visualDensity: VisualDensity.adaptivePlatformDensity, colorScheme: ColorScheme.dark(), ), home: MainPage(), ); } class MainPage extends StatefulWidget { @override _MainPageState createState() => _MainPageState(); } class _MainPageState extends State<MainPage> { int index = 0; @override Widget build(BuildContext context) => Scaffold( bottomNavigationBar: buildBottomBar(), body: buildPages(), ); Widget buildBottomBar() { final style = TextStyle(color: Colors.white); return BottomNavigationBar( backgroundColor: Theme.of(context).primaryColor, selectedItemColor: Colors.white, unselectedItemColor: Colors.white70, currentIndex: index, items: [ BottomNavigationBarItem( icon: Text('VideoPlayer', style: style), title: Text('Basics'), ), BottomNavigationBarItem( icon: Text('VideoPlayer', style: style), title: Text('Orientation'), ), ], onTap: (int index) => setState(() => this.index = index), ); } Widget buildPages() { switch (index) { case 0: return BasicsPage(); case 1: return OrientationPage(); default: return Container(); } } }
0
mirrored_repositories/video_example/lib
mirrored_repositories/video_example/lib/page/basics_page.dart
import 'package:flutter/material.dart'; import 'package:video_example/widget/basics/asset_player_widget.dart'; import 'package:video_example/widget/other/tabbar_widget.dart'; import 'package:video_example/widget/basics/file_player_widget.dart'; import 'package:video_example/widget/basics/network_player_widget.dart'; class BasicsPage extends StatelessWidget { @override Widget build(BuildContext context) => TabBarWidget( tabs: [ Tab(icon: Icon(Icons.file_copy), text: 'Asset'), Tab(icon: Icon(Icons.attach_file), text: 'File'), Tab(icon: Icon(Icons.ondemand_video_outlined), text: 'Network'), ], children: [ buildAssets(), buildFiles(), buildNetwork(), ], ); Widget buildAssets() => AssetPlayerWidget(); Widget buildFiles() => FilePlayerWidget(); Widget buildNetwork() => NetworkPlayerWidget(); }
0
mirrored_repositories/video_example/lib
mirrored_repositories/video_example/lib/page/orientation_page.dart
import 'package:flutter/material.dart'; import 'package:video_example/widget/orientation/landscape_player_page.dart'; import 'package:video_example/widget/orientation/portrait_landscape_player_page.dart'; import 'package:video_example/widget/other/tabbar_widget.dart'; import 'package:video_example/widget/orientation/portrait_player_widget.dart'; class OrientationPage extends StatelessWidget { @override Widget build(BuildContext context) => TabBarWidget( onTap: (index) { switch (index) { case 1: goToLandscape(context); break; case 2: goToPortraitAndLandscape(context); break; } }, tabs: [ Tab(icon: Icon(Icons.screen_lock_portrait), text: 'Portrait'), Tab(icon: Icon(Icons.screen_lock_landscape), text: 'Landscape'), Tab(icon: Icon(Icons.screen_rotation), text: 'Both'), ], children: [ buildPortrait(), buildLandscape(context), buildPortraitAndLandscape(context), ], ); Widget buildPortrait() => PortraitPlayerWidget(); Widget buildLandscape(BuildContext context) => buildButton( text: 'Back To Landscape', onClicked: () => goToLandscape(context), ); Widget buildPortraitAndLandscape(BuildContext context) => buildButton( text: 'Back To Both', onClicked: () => goToPortraitAndLandscape(context), ); Widget buildButton({ @required String text, @required VoidCallback onClicked, }) => Center( child: TextButton( child: Text( text, style: TextStyle(fontSize: 24), ), onPressed: onClicked, ), ); void goToLandscape(BuildContext context) => Navigator.of(context) .push(MaterialPageRoute(builder: (context) => LandscapePlayerPage())); void goToPortraitAndLandscape(BuildContext context) => Navigator.of(context).push(MaterialPageRoute( builder: (context) => PortraitLandscapePlayerPage())); }
0
mirrored_repositories/video_example/lib
mirrored_repositories/video_example/lib/widget/video_player_widget.dart
import 'package:flutter/material.dart'; import 'package:video_example/widget/basic_overlay_widget.dart'; import 'package:video_player/video_player.dart'; class VideoPlayerWidget extends StatelessWidget { final VideoPlayerController controller; const VideoPlayerWidget({ Key key, @required this.controller, }) : super(key: key); @override Widget build(BuildContext context) => controller != null && controller.value.initialized ? Container(alignment: Alignment.topCenter, child: buildVideo()) : Container( height: 200, child: Center(child: CircularProgressIndicator()), ); Widget buildVideo() => Stack( children: <Widget>[ buildVideoPlayer(), Positioned.fill(child: BasicOverlayWidget(controller: controller)), ], ); Widget buildVideoPlayer() => AspectRatio( aspectRatio: controller.value.aspectRatio, child: VideoPlayer(controller), ); }
0
mirrored_repositories/video_example/lib
mirrored_repositories/video_example/lib/widget/advanced_overlay_widget.dart
import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; class AdvancedOverlayWidget extends StatelessWidget { final VideoPlayerController controller; final VoidCallback onClickedFullScreen; static const allSpeeds = <double>[0.25, 0.5, 1, 1.5, 2, 3, 5, 10]; const AdvancedOverlayWidget({ Key key, @required this.controller, this.onClickedFullScreen, }) : super(key: key); String getPosition() { final duration = Duration( milliseconds: controller.value.position.inMilliseconds.round()); return [duration.inMinutes, duration.inSeconds] .map((seg) => seg.remainder(60).toString().padLeft(2, '0')) .join(':'); } @override Widget build(BuildContext context) => GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => controller.value.isPlaying ? controller.pause() : controller.play(), child: Stack( children: <Widget>[ buildPlay(), buildSpeed(), Positioned( left: 8, bottom: 28, child: Text(getPosition()), ), Positioned( bottom: 0, left: 0, right: 0, child: Row( children: [ Expanded(child: buildIndicator()), const SizedBox(width: 12), GestureDetector( child: Icon( Icons.fullscreen, color: Colors.white, size: 28, ), onTap: onClickedFullScreen, ), const SizedBox(width: 8), ], )), ], ), ); Widget buildIndicator() => Container( margin: EdgeInsets.all(8).copyWith(right: 0), height: 16, child: VideoProgressIndicator( controller, allowScrubbing: true, ), ); Widget buildSpeed() => Align( alignment: Alignment.topRight, child: PopupMenuButton<double>( initialValue: controller.value.playbackSpeed, tooltip: 'Playback speed', onSelected: controller.setPlaybackSpeed, itemBuilder: (context) => allSpeeds .map<PopupMenuEntry<double>>((speed) => PopupMenuItem( value: speed, child: Text('${speed}x'), )) .toList(), child: Container( color: Colors.white38, padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), child: Text('${controller.value.playbackSpeed}x'), ), ), ); Widget buildPlay() => AnimatedSwitcher( duration: Duration(milliseconds: 50), reverseDuration: Duration(milliseconds: 200), child: controller.value.isPlaying ? Container() : Container( color: Colors.black26, child: Center( child: Icon( Icons.play_arrow, color: Colors.white, size: 70, ), ), ), ); }
0
mirrored_repositories/video_example/lib
mirrored_repositories/video_example/lib/widget/basic_overlay_widget.dart
import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; class BasicOverlayWidget extends StatelessWidget { final VideoPlayerController controller; const BasicOverlayWidget({ Key key, @required this.controller, }) : super(key: key); @override Widget build(BuildContext context) => GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => controller.value.isPlaying ? controller.pause() : controller.play(), child: Stack( children: <Widget>[ buildPlay(), Positioned( bottom: 0, left: 0, right: 0, child: buildIndicator(), ), ], ), ); Widget buildIndicator() => VideoProgressIndicator( controller, allowScrubbing: true, ); Widget buildPlay() => controller.value.isPlaying ? Container() : Container( alignment: Alignment.center, color: Colors.black26, child: Icon(Icons.play_arrow, color: Colors.white, size: 80), ); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/orientation/landscape_player_page.dart
import 'package:auto_orientation/auto_orientation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:video_example/main.dart'; import 'package:video_example/widget/orientation/video_player_fullscreen_widget.dart'; import 'package:video_player/video_player.dart'; import 'package:wakelock/wakelock.dart'; class LandscapePlayerPage extends StatefulWidget { @override _LandscapePlayerPageState createState() => _LandscapePlayerPageState(); } class _LandscapePlayerPageState extends State<LandscapePlayerPage> { VideoPlayerController controller; @override void initState() { super.initState(); controller = VideoPlayerController.network(urlLandscapeVideo) ..addListener(() => setState(() {})) ..setLooping(true) ..initialize().then((_) => controller.play()); setLandscape(); } @override void dispose() { controller.dispose(); setAllOrientations(); super.dispose(); } Future setLandscape() async { // hide overlays statusbar await SystemChrome.setEnabledSystemUIOverlays([]); await SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); await Wakelock.enable(); // keep device awake } Future setAllOrientations() async { await SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); await SystemChrome.setPreferredOrientations(DeviceOrientation.values); await Wakelock.disable(); } @override Widget build(BuildContext context) => VideoPlayerFullscreenWidget(controller: controller); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/orientation/portrait_landscape_player_page.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:video_example/main.dart'; import 'package:video_example/widget/orientation/video_player_both_widget.dart'; import 'package:video_example/widget/orientation/video_player_fullscreen_widget.dart'; import 'package:video_player/video_player.dart'; import 'package:wakelock/wakelock.dart'; class PortraitLandscapePlayerPage extends StatefulWidget { @override _PortraitLandscapePlayerPageState createState() => _PortraitLandscapePlayerPageState(); } class _PortraitLandscapePlayerPageState extends State<PortraitLandscapePlayerPage> { VideoPlayerController controller; @override void initState() { super.initState(); controller = VideoPlayerController.network(urlLandscapeVideo) ..addListener(() => setState(() {})) ..setLooping(true) ..initialize().then((_) => controller.play()); } @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) => Scaffold( appBar: AppBar(toolbarHeight: 0), body: VideoPlayerBothWidget(controller: controller), ); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/orientation/video_player_both_widget.dart
import 'dart:async'; import 'package:auto_orientation/auto_orientation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:native_device_orientation/native_device_orientation.dart'; import 'package:video_example/widget/advanced_overlay_widget.dart'; import 'package:video_example/widget/basic_overlay_widget.dart'; import 'package:video_player/video_player.dart'; import 'package:wakelock/wakelock.dart'; class VideoPlayerBothWidget extends StatefulWidget { final VideoPlayerController controller; const VideoPlayerBothWidget({ Key key, @required this.controller, }) : super(key: key); @override _VideoPlayerBothWidgetState createState() => _VideoPlayerBothWidgetState(); } class _VideoPlayerBothWidgetState extends State<VideoPlayerBothWidget> { StreamSubscription subscription; Orientation target; @override void initState() { super.initState(); subscription = NativeDeviceOrientationCommunicator() .onOrientationChanged(useSensor: true) .listen((event) { final isPortrait = event == NativeDeviceOrientation.portraitUp; final isLandscape = event == NativeDeviceOrientation.landscapeLeft || event == NativeDeviceOrientation.landscapeRight; final isTargetPortrait = target == Orientation.portrait; final isTargetLandscape = target == Orientation.landscape; if (isPortrait && isTargetPortrait || isLandscape && isTargetLandscape) { target = null; SystemChrome.setPreferredOrientations(DeviceOrientation.values); } }); } @override void dispose() { subscription.cancel(); super.dispose(); } void setOrientation(bool isPortrait) { if (isPortrait) { Wakelock.disable(); SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); } else { Wakelock.enable(); SystemChrome.setEnabledSystemUIOverlays([]); } } @override Widget build(BuildContext context) => widget.controller != null && widget.controller.value.initialized ? Container(alignment: Alignment.topCenter, child: buildVideo()) : Center(child: CircularProgressIndicator()); Widget buildVideo() => OrientationBuilder( builder: (context, orientation) { final isPortrait = orientation == Orientation.portrait; setOrientation(isPortrait); return Stack( fit: isPortrait ? StackFit.loose : StackFit.expand, children: <Widget>[ buildVideoPlayer(isPortrait), Positioned.fill( child: AdvancedOverlayWidget( controller: widget.controller, onClickedFullScreen: () { target = isPortrait ? Orientation.landscape : Orientation.portrait; if (isPortrait) { AutoOrientation.landscapeRightMode(); } else { AutoOrientation.portraitUpMode(); } }, ), ), ], ); }, ); Widget buildVideoPlayer(bool isPortrait) { final video = AspectRatio( aspectRatio: widget.controller.value.aspectRatio, child: VideoPlayer(widget.controller), ); if (isPortrait) { return video; } else { return WillPopScope( onWillPop: () { AutoOrientation.portraitUpMode(); return Future.value(false); }, child: buildFullScreen(child: video), ); } } Widget buildFullScreen({ @required Widget child, }) { final size = widget.controller.value.size; final width = size?.width ?? 0; final height = size?.height ?? 0; return FittedBox( fit: BoxFit.cover, child: SizedBox(width: width, height: height, child: child), ); } }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/orientation/video_player_fullscreen_widget.dart
import 'package:flutter/material.dart'; import 'package:video_example/widget/basic_overlay_widget.dart'; import 'package:video_player/video_player.dart'; class VideoPlayerFullscreenWidget extends StatelessWidget { final VideoPlayerController controller; const VideoPlayerFullscreenWidget({ Key key, @required this.controller, }) : super(key: key); @override Widget build(BuildContext context) => controller != null && controller.value.initialized ? Container(alignment: Alignment.topCenter, child: buildVideo()) : Center(child: CircularProgressIndicator()); Widget buildVideo() => Stack( fit: StackFit.expand, children: <Widget>[ buildVideoPlayer(), BasicOverlayWidget(controller: controller), ], ); Widget buildVideoPlayer() => buildFullScreen( child: AspectRatio( aspectRatio: controller.value.aspectRatio, child: VideoPlayer(controller), ), ); Widget buildFullScreen({ @required Widget child, }) { final size = controller.value.size; final width = size?.width ?? 0; final height = size?.height ?? 0; return FittedBox( fit: BoxFit.cover, child: SizedBox(width: width, height: height, child: child), ); } }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/orientation/portrait_player_widget.dart
import 'package:flutter/material.dart'; import 'package:video_example/main.dart'; import 'package:video_example/widget/orientation/video_player_fullscreen_widget.dart'; import 'package:video_player/video_player.dart'; class PortraitPlayerWidget extends StatefulWidget { @override _PortraitPlayerWidgetState createState() => _PortraitPlayerWidgetState(); } class _PortraitPlayerWidgetState extends State<PortraitPlayerWidget> { VideoPlayerController controller; @override void initState() { super.initState(); /// for testing purposes: 'https://firebasestorage.googleapis.com/v0/b/web-johannesmilke.appspot.com/o/ezgif-7-565b5237f95f.mp4?alt=media&token=51e8e031-1e87-46e6-bd32-98c5367da59d' controller = VideoPlayerController.network(urlPortraitVideo) ..addListener(() => setState(() {})) ..setLooping(true) ..initialize().then((_) => controller.play()); } @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) => VideoPlayerFullscreenWidget(controller: controller); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/other/floating_action_button_widget.dart
import 'package:flutter/material.dart'; class FloatingActionButtonWidget extends StatelessWidget { final VoidCallback onPressed; const FloatingActionButtonWidget({ Key key, @required this.onPressed, }) : super(key: key); @override Widget build(BuildContext context) => FloatingActionButton( child: Icon(Icons.add, size: 32), onPressed: onPressed, backgroundColor: Colors.purple, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), ); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/other/tabbar_widget.dart
import 'package:flutter/material.dart'; class TabBarWidget extends StatelessWidget { final List<Tab> tabs; final List<Widget> children; final ValueChanged<int> onTap; const TabBarWidget({ Key key, @required this.tabs, @required this.children, this.onTap, }) : super(key: key); @override Widget build(BuildContext context) => DefaultTabController( length: tabs.length, child: Scaffold( appBar: AppBar( flexibleSpace: Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [Colors.purple, Colors.blue], begin: Alignment.bottomRight, end: Alignment.topLeft, ), ), ), toolbarHeight: 80, bottom: TabBar( onTap: onTap, indicatorColor: Colors.white, indicatorWeight: 5, tabs: tabs, ), elevation: 20, titleSpacing: 20, ), body: SafeArea(child: TabBarView(children: children)), ), ); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/other/textfield_widget.dart
import 'package:flutter/material.dart'; class TextFieldWidget extends StatelessWidget { final TextEditingController controller; final String hintText; const TextFieldWidget({ Key key, @required this.controller, @required this.hintText, }) : super(key: key); @override Widget build(BuildContext context) => TextField( controller: controller, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20, ), decoration: InputDecoration( hintText: hintText, hintStyle: TextStyle(color: Colors.grey), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), borderSide: BorderSide(color: Colors.white), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(16), borderSide: BorderSide(color: Theme.of(context).primaryColor), ), ), ); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/basics/network_player_widget.dart
import 'package:flutter/material.dart'; import 'package:video_example/widget/video_player_widget.dart'; import 'package:video_player/video_player.dart'; import '../../main.dart'; import '../other/floating_action_button_widget.dart'; import '../other/textfield_widget.dart'; class NetworkPlayerWidget extends StatefulWidget { @override _NetworkPlayerWidgetState createState() => _NetworkPlayerWidgetState(); } class _NetworkPlayerWidgetState extends State<NetworkPlayerWidget> { final textController = TextEditingController(text: urlLandscapeVideo); VideoPlayerController controller; @override void initState() { super.initState(); controller = VideoPlayerController.network(textController.text) ..addListener(() => setState(() {})) ..setLooping(true) ..initialize().then((_) => controller.play()); } @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) => Container( alignment: Alignment.center, child: Column( children: [ VideoPlayerWidget(controller: controller), buildTextField(), ], ), ); Widget buildTextField() => Container( padding: EdgeInsets.all(32), child: Row( children: [ Expanded( child: TextFieldWidget( controller: textController, hintText: 'Enter Video Url', ), ), const SizedBox(width: 12), FloatingActionButtonWidget( onPressed: () { if (textController.text.trim().isEmpty) return; }, ), ], ), ); }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/basics/file_player_widget.dart
import 'dart:io'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:video_example/widget/other/floating_action_button_widget.dart'; import 'package:video_example/widget/video_player_widget.dart'; import 'package:video_player/video_player.dart'; class FilePlayerWidget extends StatefulWidget { @override _FilePlayerWidgetState createState() => _FilePlayerWidgetState(); } class _FilePlayerWidgetState extends State<FilePlayerWidget> { final File file = File( '/data/user/0/com.example.video_example/cache/file_picker/big_buck_bunny_720p_10mb.mp4'); VideoPlayerController controller; @override void initState() { super.initState(); if (file.existsSync()) { controller = VideoPlayerController.file(file) ..addListener(() => setState(() {})) ..setLooping(true) ..initialize().then((_) => controller.play()); } } @override void dispose() { controller?.dispose(); super.dispose(); } @override Widget build(BuildContext context) => Scaffold( body: Column( children: [ VideoPlayerWidget(controller: controller), buildAddButton(), ], ), ); Widget buildAddButton() => Container( padding: EdgeInsets.all(32), child: FloatingActionButtonWidget( onPressed: () async { final file = await pickVideoFile(); if (file == null) return; controller = VideoPlayerController.file(file) ..addListener(() => setState(() {})) ..setLooping(true) ..initialize().then((_) { controller.play(); setState(() {}); }); }, ), ); Future<File> pickVideoFile() async { final result = await FilePicker.platform.pickFiles(type: FileType.video); if (result == null) return null; return File(result.files.single.path); } }
0
mirrored_repositories/video_example/lib/widget
mirrored_repositories/video_example/lib/widget/basics/asset_player_widget.dart
import 'package:flutter/material.dart'; import 'package:video_example/widget/video_player_widget.dart'; import 'package:video_player/video_player.dart'; class AssetPlayerWidget extends StatefulWidget { @override _AssetPlayerWidgetState createState() => _AssetPlayerWidgetState(); } class _AssetPlayerWidgetState extends State<AssetPlayerWidget> { final asset = 'assets/video.mp4'; VideoPlayerController controller; @override void initState() { super.initState(); controller = VideoPlayerController.asset(asset) ..addListener(() => setState(() {})) ..setLooping(true) ..initialize().then((_) => controller.play()); } @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { final isMuted = controller.value.volume == 0; return Column( children: [ VideoPlayerWidget(controller: controller), const SizedBox(height: 32), if (controller != null && controller.value.initialized) CircleAvatar( radius: 30, backgroundColor: Colors.red, child: IconButton( icon: Icon( isMuted ? Icons.volume_mute : Icons.volume_up, color: Colors.white, ), onPressed: () => controller.setVolume(isMuted ? 1 : 0), ), ) ], ); } }
0
mirrored_repositories/Easy-Exchange
mirrored_repositories/Easy-Exchange/lib/main.dart
import 'package:easy_exchange/ui/widget/bottom-navigation-bar.widget.dart'; import 'package:easy_exchange/util/colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; void main() => runApp(EasyExchange()); class EasyExchange extends StatelessWidget { @override Widget build(BuildContext context) { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith( statusBarColor: Colors.white, /* set Status bar color in Android devices. */ statusBarIconBrightness: Brightness.dark, /* set Status bar icons color in Android devices.*/ statusBarBrightness: Brightness.dark) /* set Status bar icon color in iOS. */ ); return MaterialApp( title: 'Easy Exchange', theme: ThemeData( primaryColor: primaryColor, scaffoldBackgroundColor: Color(0xFFFFFFFF), fontFamily: 'TitilliumWeb', primaryTextTheme: TextTheme( headline6: TextStyle(color: primaryColor, fontSize: 26.0, fontWeight: FontWeight.bold)), appBarTheme: AppBarTheme(color: Colors.white, brightness: Brightness.light), ), debugShowCheckedModeBanner: false, home: ChangeNotifierProvider<BottomNavigationBarProvider>( child: BottomNavigationBarWidget(), create: (BuildContext context) => BottomNavigationBarProvider(), ), ); } }
0
mirrored_repositories/Easy-Exchange/lib
mirrored_repositories/Easy-Exchange/lib/model/currency-rates.dart
import 'package:money/money.dart'; class CurrencyRates { final Currency baseCurrency; final List<Rate> rates; CurrencyRates([this.baseCurrency, this.rates]); factory CurrencyRates.fromJson(Map<String, dynamic> json) { final baseCurrency = json['base']; return CurrencyRates( Currency(baseCurrency), _parseRates(json['rates'], baseCurrency)); } } class HistoricalRates { final Currency baseCurrency; final List<HistoryRatePoint> rates; HistoricalRates(this.baseCurrency, this.rates); factory HistoricalRates.fromJson(Map<String, dynamic> json) { final baseCurrency = json['base']; final Map<String, dynamic> ratesMap = json['rates']; return HistoricalRates( Currency(baseCurrency), ratesMap.entries.map((MapEntry<String, dynamic> entry) { return HistoryRatePoint( DateTime.parse(entry.key), _parseRates(entry.value, baseCurrency), ); }).toList(), ); } } class HistoryRatePoint { final DateTime date; final List<Rate> rates; HistoryRatePoint(this.date, this.rates); } class Rate { Currency currency; double rate; Rate(this.currency, this.rate); } List<Rate> _parseRates(Map<String, dynamic> ratesMap, String baseCurrencyCode) { return ratesMap.keys .where((code) => code != baseCurrencyCode) .map((code) => Rate(Currency(code), ratesMap[code])) .toList(); }
0
mirrored_repositories/Easy-Exchange/lib
mirrored_repositories/Easy-Exchange/lib/model/index.dart
export 'package:easy_exchange/model/currency-rates.dart';
0
mirrored_repositories/Easy-Exchange/lib
mirrored_repositories/Easy-Exchange/lib/util/colors.dart
import 'package:flutter/material.dart'; // App's main colors const primaryColor = const Color(0xFF3783F5); const primaryGrey = const Color(0xFFEDF1F9);
0
mirrored_repositories/Easy-Exchange/lib
mirrored_repositories/Easy-Exchange/lib/util/url.dart
class Url{ static const String exchangeBaseUrl = 'https://api.exchangeratesapi.io/'; }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/pages/rates.page.dart
import 'package:easy_exchange/ui/widget/currency-button.widget.dart'; import 'package:easy_exchange/ui/widget/currency-rates-rounded-list.widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; class RatesPage extends StatefulWidget { const RatesPage({Key key}) : super(key: key); @override _RatesPageState createState() => _RatesPageState(); } class _RatesPageState extends State<RatesPage> { String _originCurrencyCode = "EUR"; @override Widget build(BuildContext context) { changeOrigenCurrency(newOrigenCurrencyCode, newOrigenCurrencyRate) { setState(() { _originCurrencyCode = newOrigenCurrencyCode; }); } return Scaffold( body: SingleChildScrollView( child: Center( child: Column( children: <Widget>[ CurrencyButton(_originCurrencyCode, changeOrigenCurrency), Divider(), CurrencyRateRoundedList(_originCurrencyCode) ],), ), ), ); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/pages/converter.page.dart
import 'package:easy_exchange/model/index.dart'; import 'package:easy_exchange/services/repository/currency-rates-repository.dart'; import 'package:easy_exchange/ui/widget/amount-input.widget.dart'; import 'package:easy_exchange/ui/widget/currency-button.widget.dart'; import 'package:easy_exchange/ui/widget/swap-currencies-button.widget.dart'; import 'package:easy_exchange/util/colors.dart'; import 'package:flutter/material.dart'; class ExchangePage extends StatefulWidget { @override _ExchangePageState createState() => _ExchangePageState(); } class _ExchangePageState extends State<ExchangePage> { String _originCurrencyCode = "EUR"; String _destinationCurrencyCode = "USD"; double _destinationCurrencyRate = 1.13; double amountToConvert = 0.0; CurrencyRatesRepository _repository = new CurrencyRatesRepository(); changeOrigenCurrency(newOrigenCurrencyCode, newOrigenCurrencyRate) async { CurrencyRates rates = await _repository.fetchSpecificCurrencyRates( newOrigenCurrencyCode, _destinationCurrencyCode); setState(() { _originCurrencyCode = newOrigenCurrencyCode; _destinationCurrencyRate = rates.rates[0].rate; }); } changeDestinationCurrency( newDestinationCurrencyCode, newDestinationCurrencyRate) async { CurrencyRates rates = await _repository.fetchSpecificCurrencyRates( _originCurrencyCode, newDestinationCurrencyCode); setState(() { _destinationCurrencyCode = newDestinationCurrencyCode; _destinationCurrencyRate = rates.rates[0].rate; }); } changeAmount(newAmount) { setState(() { amountToConvert = double.parse(newAmount); }); } swapCurrencies() async { CurrencyRates rates = await _repository.fetchSpecificCurrencyRates( _destinationCurrencyCode, _originCurrencyCode); setState(() { String temporaryString = _originCurrencyCode; _originCurrencyCode = _destinationCurrencyCode; _destinationCurrencyCode = temporaryString; _destinationCurrencyRate = rates.rates[0].rate; }); } @override Widget build(BuildContext context) { final halfMediaWidth = MediaQuery.of(context).size.width / 1.1; return Scaffold( resizeToAvoidBottomInset: false, body: Center( child: Column( children: <Widget>[ Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("Amount", style: TextStyle(color: Colors.grey, fontSize: 20.0)), SizedBox( height: 10.0, ), Container( width: halfMediaWidth, height: 55.0, child: AmountInput(changeAmount)), ], ), SizedBox( height: 40.0, ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("From", style: TextStyle(color: Colors.grey, fontSize: 20.0)), SizedBox( height: 10.0, ), CurrencyButton(_originCurrencyCode, changeOrigenCurrency), ], ), Column( children: <Widget>[ SizedBox( height: 40.0, ), SwapCurrenciesButton(swapCurrencies), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( "To", style: TextStyle(color: Colors.grey, fontSize: 20.0), ), SizedBox( height: 10.0, ), CurrencyButton( _destinationCurrencyCode, changeDestinationCurrency), ], ), ], ), SizedBox( height: 30.0, ), Text( "1 " + _originCurrencyCode + " = " + _destinationCurrencyRate.toString() + " " + _destinationCurrencyCode, style: TextStyle(fontSize: 16.0), ), SizedBox( height: 40.0, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text( (amountToConvert).toStringAsFixed(2), style: TextStyle( fontSize: 21.0, color: Colors.grey, fontWeight: FontWeight.bold)), SizedBox(width: 10.0,), Text(_originCurrencyCode, style: TextStyle( fontSize: 21.0, color: Colors.grey,)) ], ), Text("=", style: TextStyle( fontSize: 24.0, color: Colors.grey, fontWeight: FontWeight.bold)), Text( (amountToConvert * _destinationCurrencyRate) .toStringAsFixed(2) + " " + _destinationCurrencyCode, style: TextStyle( fontSize: 45, color: primaryColor, fontWeight: FontWeight.bold)), ], ))); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/pages/graphs.page.dart
import 'package:custom_radio_grouped_button/CustomButtons/CustomRadioButton.dart'; import 'package:easy_exchange/ui/widget/currency-button.widget.dart'; import 'package:easy_exchange/ui/widget/currency-history-graph.widget.dart'; import 'package:easy_exchange/ui/widget/swap-currencies-button.widget.dart'; import 'package:easy_exchange/util/colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; class GraphsPage extends StatefulWidget { const GraphsPage({Key key}) : super(key: key); @override _GraphsPageState createState() => _GraphsPageState(); } class _GraphsPageState extends State<GraphsPage> with SingleTickerProviderStateMixin { String _originCurrencyCode = "EUR"; String _destinationCurrencyCode = "USD"; int _days = 1; changeOrigenCurrency(newOrigenCurrencyCode, newOrigenCurrencyRate) { setState(() { _originCurrencyCode = newOrigenCurrencyCode; }); } changeDestinationCurrency( newDestinationCurrencyCode, newDestinationCurrencyRate) { setState(() { _destinationCurrencyCode = newDestinationCurrencyCode; }); } swapCurrencies() { setState(() { String temporaryString = _originCurrencyCode; _originCurrencyCode = _destinationCurrencyCode; _destinationCurrencyCode = temporaryString; }); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ CurrencyButton(_originCurrencyCode, changeOrigenCurrency), SwapCurrenciesButton(swapCurrencies), CurrencyButton( _destinationCurrencyCode, changeDestinationCurrency), ], ), SizedBox( height: 20.0, ), Row( children: <Widget>[ Expanded( child: Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: CustomRadioButton( horizontal: false, enableShape: true, hight: 45.0, customShape: CircleBorder(), elevation: 2.0, buttonColor: primaryGrey, buttonLables: [ "1D", "1S", "1M", "3M", "1A", "5A", ], buttonValues: [ "1", "7", "30", "90", "365", "1825", ], radioButtonValue: (value) { setState(() { _days = int.parse(value); }); }, selectedColor: primaryColor, ), ), ) ], ), SizedBox(height: 10.0,), Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 22.0), child: Text( _originCurrencyCode + "/" + _destinationCurrencyCode, style: TextStyle( color: primaryColor, fontWeight: FontWeight.bold, fontSize: 18.0)), ) ], ), CurrencyHistoryGraph( _originCurrencyCode, _destinationCurrencyCode, _days) ], ), ), ); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/bottom-navigation-bar.widget.dart
import 'package:easy_exchange/ui/pages/converter.page.dart'; import 'package:easy_exchange/ui/pages/graphs.page.dart'; import 'package:easy_exchange/ui/pages/rates.page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class BottomNavigationBarWidget extends StatefulWidget { BottomNavigationBarWidget({Key key}) : super(key: key); @override _BottomNavigationBarState createState() => _BottomNavigationBarState(); } class _BottomNavigationBarState extends State<BottomNavigationBarWidget> { final _scaffoldKey = GlobalKey<ScaffoldState>(); String appBarTitle = "Converter"; var currentTab = [ RatesPage(), ExchangePage(), GraphsPage(), ]; @override Widget build(BuildContext context) { var provider = Provider.of<BottomNavigationBarProvider>(context); return Scaffold( key: _scaffoldKey, resizeToAvoidBottomInset: false, appBar: new AppBar( title: Text( appBarTitle, ), centerTitle: true, elevation: 0.0, ), body: IndexedStack( index: provider.currentIndex, children: currentTab, ), bottomNavigationBar: BottomNavigationBar( currentIndex: provider.currentIndex, onTap: (index) { provider.currentIndex = index; if(index == 0){ setState(() { appBarTitle = "Rates"; }); } else if(index == 1){ setState(() { appBarTitle = "Converter"; }); } else if(index == 2){ setState(() { appBarTitle = "Graph"; }); } }, items: [ BottomNavigationBarItem( icon: Image.asset('assets/images/dollar-sign.png'), activeIcon: Image.asset('assets/images/dollar-sign-active.png'), title: Text('Rates'), ), BottomNavigationBarItem( icon: Image.asset('assets/images/converter.png'), activeIcon: Image.asset('assets/images/converter-active.png'), title: Text('Converter'), ), BottomNavigationBarItem( icon: Image.asset('assets/images/graph.png'), activeIcon: Image.asset('assets/images/graph-active.png'), title: Text('Graph'), ), ], ), ); } } class BottomNavigationBarProvider with ChangeNotifier { int _currentIndex = 1; get currentIndex => _currentIndex; set currentIndex(int index) { _currentIndex = index; notifyListeners(); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/currency-button.widget.dart
import 'package:easy_exchange/ui/widget/currencies-bottom-sheet.widget.dart'; import 'package:easy_exchange/util/colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; typedef void StringCallback(String code, double rate); class CurrencyButton extends StatefulWidget { final String baseCurrency; final StringCallback callback; const CurrencyButton(this.baseCurrency, this.callback); @override _CurrencyButtonState createState() => _CurrencyButtonState(); } class _CurrencyButtonState extends State<CurrencyButton> { @override Widget build(BuildContext context) { return RaisedButton( elevation: 2.0, color: primaryGrey, child: Padding( padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), child: Row( mainAxisSize: MainAxisSize.min, children: <Widget>[ Row( children: <Widget>[ CircleAvatar( radius: 18.0, backgroundImage: AssetImage( 'icons/currency/${widget.baseCurrency.toLowerCase()}.png', package: 'currency_icons', ), ), SizedBox( width: 5.0, ), Text( widget.baseCurrency, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24.0), ), ], ), ], ), ), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)), textColor: Colors.black, onPressed: () => showModalBottomSheet( backgroundColor: Colors.transparent, isScrollControlled: true, context: context, builder: (_) => CurrenciesBottomSheet(widget.baseCurrency, widget.callback)), ); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/currency-rates-rounded-list.widget.dart
import 'package:easy_exchange/services/bloc/currency-rate-bloc.dart'; import 'package:easy_exchange/model/index.dart'; import 'package:easy_exchange/services/networking/index.dart'; import 'package:easy_exchange/util/colors.dart'; import 'package:flutter/material.dart'; class CurrencyRateRoundedList extends StatelessWidget { final String baseCurrency; CurrencyRateRoundedList(this.baseCurrency); @override Widget build(BuildContext context) { final CurrencyRatesListBloc _bloc = CurrencyRatesListBloc(); _bloc.fetchBaseCurrencyRates(this.baseCurrency); return StreamBuilder<Response<CurrencyRates>>( stream: _bloc.currencyRatesListStream, builder: (context, snapshot) { if (snapshot.hasData) { switch (snapshot.data.status) { case Status.LOADING: return Center(child: CircularProgressIndicator()); break; case Status.COMPLETED: return Row( children: <Widget>[ Expanded( child: ListView.separated( separatorBuilder: (BuildContext context, int index) => SizedBox(height: 10.0,), itemCount: snapshot.data.data.rates.length, padding: EdgeInsets.all(10.0), shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { return RaisedButton( color: primaryGrey, child: ListTile( leading: CircleAvatar( radius: 22.0, backgroundImage: AssetImage( 'icons/currency/${snapshot.data.data.rates[index].currency.code.toLowerCase()}.png', package: 'currency_icons', ), ), title: Text(snapshot .data.data.rates[index].currency.name), subtitle: Text(snapshot .data.data.rates[index].currency.code), trailing: Text( snapshot.data.data.rates[index].rate .toStringAsFixed(5), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold), ),), onPressed: () {}, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)), ); }), ), ], ); break; case Status.ERROR: return Center(child: CircularProgressIndicator()); break; } } return Container(); }); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/currency-rates-list.widget.dart
import 'package:easy_exchange/services/bloc/currency-rate-bloc.dart'; import 'package:easy_exchange/model/index.dart'; import 'package:easy_exchange/services/networking/index.dart'; import 'package:flutter/material.dart'; typedef void StringCallback(String code, double rate); class CurrencyRateList extends StatelessWidget { final String baseCurrency; final StringCallback callback; CurrencyRateList(this.baseCurrency, this.callback); @override Widget build(BuildContext context) { final CurrencyRatesListBloc _bloc = CurrencyRatesListBloc(); _bloc.fetchBaseCurrencyRates(this.baseCurrency); return StreamBuilder<Response<CurrencyRates>>( stream: _bloc.currencyRatesListStream, builder: (context, snapshot) { if (snapshot.hasData) { switch (snapshot.data.status) { case Status.LOADING: return Center(child: CircularProgressIndicator()); break; case Status.COMPLETED: return Row( children: <Widget>[ Expanded( child: ListView.builder( itemCount: snapshot.data.data.rates.length, padding: EdgeInsets.all(0.0), shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) { return ListTile( leading: CircleAvatar( radius: 18.0, backgroundImage: AssetImage( 'icons/currency/${snapshot.data.data.rates[index].currency.code.toLowerCase()}.png', package: 'currency_icons', ), ), title: Text(snapshot .data.data.rates[index].currency.name), subtitle: Text(snapshot .data.data.rates[index].currency.code), onTap: () { callback(snapshot .data.data.rates[index].currency.code, snapshot .data.data.rates[index].rate); Navigator.pop(context); }); }), ), ], ); break; case Status.ERROR: return Center(child: CircularProgressIndicator()); break; } } return Container(); }); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/amount-input.widget.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_multi_formatter/flutter_multi_formatter.dart'; import 'package:flutter_multi_formatter/formatters/money_input_formatter.dart'; typedef void StringCallback(String number); class AmountInput extends StatelessWidget { final StringCallback callback; AmountInput(this.callback); @override Widget build(BuildContext context) { return TextField( maxLength: 20, decoration: InputDecoration( counterText: '', border: OutlineInputBorder( borderRadius: BorderRadius.circular(25.0), ), ), style: TextStyle(fontSize: 18.0), textInputAction: TextInputAction.done, keyboardType: TextInputType.number, textAlign: TextAlign.center, maxLines: 1, onChanged: (text) { callback(text); }, inputFormatters: [ MoneyInputFormatter(thousandSeparator: ThousandSeparator.None), BlacklistingTextInputFormatter(new RegExp('-')), ], ); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/currency-history-graph.widget.dart
import 'dart:math'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:charts_flutter/src/text_style.dart' as style; import 'package:charts_flutter/src/text_element.dart'; import 'package:charts_flutter/flutter.dart'; import 'package:easy_exchange/model/index.dart'; import 'package:easy_exchange/services/bloc/currency-rates-history-bloc.dart'; import 'package:easy_exchange/services/networking/index.dart'; import 'package:easy_exchange/util/colors.dart'; import 'package:flutter/material.dart'; class CurrencyHistoryGraph extends StatelessWidget { final String originCurrency; final String destinationCurrency; final int days; CurrencyHistoryGraph(this.originCurrency, this.destinationCurrency, this.days); @override Widget build(BuildContext context) { final CurrencyRatesHistoryListBloc _bloc = CurrencyRatesHistoryListBloc(); _bloc.fetchCurrencyRatesHistory(this.originCurrency, this.destinationCurrency, this.days); return StreamBuilder<Response<HistoricalRates>>( stream: _bloc.currencyRatesListStream, builder: (context, snapshot) { if (snapshot.hasData) { switch (snapshot.data.status) { case Status.LOADING: return Center(child: CircularProgressIndicator()); break; case Status.COMPLETED: return Padding( padding: const EdgeInsets.all(8.0), child: AspectRatio( child: _buildHistoryChartChart(snapshot.data.data), aspectRatio: 1.5, ), ); break; case Status.ERROR: return Center(child: CircularProgressIndicator()); break; } } return Container(); }); } charts.TimeSeriesChart _buildHistoryChartChart( HistoricalRates ratesResponse) { List<HistoryRatePoint> rates = ratesResponse.rates; rates.sort((a, b) => a.date.compareTo(b.date)); final seriesList = _createListData(rates); CustomCircleSymbolRenderer render = new CustomCircleSymbolRenderer(''); return charts.TimeSeriesChart(seriesList, animate: true, defaultRenderer: charts.LineRendererConfig(includePoints: true), primaryMeasureAxis: charts.NumericAxisSpec( tickProviderSpec: charts.BasicNumericTickProviderSpec( zeroBound: false, dataIsInWholeNumbers: false, desiredMinTickCount: 2, desiredMaxTickCount: 10, ), ), behaviors: [ charts.PanAndZoomBehavior(), charts.LinePointHighlighter( symbolRenderer: render, showHorizontalFollowLine: charts.LinePointHighlighterFollowLineType.nearest, showVerticalFollowLine: charts.LinePointHighlighterFollowLineType.nearest), ], selectionModels: [ SelectionModelConfig(changedListener: (SelectionModel model) { render.label = model.selectedSeries[0] .measureFn(model.selectedDatum[0].index) .toString(); }) ], ); } static List<charts.Series<HistoryRatePoint, DateTime>> _createListData( List<HistoryRatePoint> data) { return [ charts.Series<HistoryRatePoint, DateTime>( id: 'Currency', colorFn: (_, __) => charts.ColorUtil.fromDartColor(primaryColor), domainFn: (HistoryRatePoint point, _) => point.date, measureFn: (HistoryRatePoint point, _) => point.rates.first.rate, data: data, ) ]; } } class CustomCircleSymbolRenderer extends CircleSymbolRenderer { String label; CustomCircleSymbolRenderer(this.label); @override void paint(ChartCanvas canvas, Rectangle<num> bounds, {List<int> dashPattern, Color fillColor, Color strokeColor, double strokeWidthPx}) { super.paint(canvas, bounds, dashPattern: dashPattern, fillColor: fillColor, strokeColor: strokeColor, strokeWidthPx: strokeWidthPx); canvas.drawRect( Rectangle(bounds.left - 5, bounds.top - 30, bounds.width + 10, bounds.height + 10), fill: Color.white ); var textStyle = style.TextStyle(); textStyle.color = Color.black; textStyle.fontSize = 15; canvas.drawText( TextElement(this.label, style: textStyle), (bounds.left).round(), (bounds.top - 28).round() ); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/swap-currencies-button.widget.dart
import 'package:easy_exchange/util/colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; typedef void Callback(); class SwapCurrenciesButton extends StatelessWidget { final Callback callback; const SwapCurrenciesButton(this.callback); @override Widget build(BuildContext context) { return Container( child: RawMaterialButton( onPressed: () { callback(); }, elevation: 2.0, fillColor: primaryColor, child: Image.asset('assets/images/switch.png', fit: BoxFit.fill), padding: EdgeInsets.all(15.0), shape: CircleBorder(side: BorderSide(color: primaryGrey, width: 3.0)), ), ); } }
0
mirrored_repositories/Easy-Exchange/lib/ui
mirrored_repositories/Easy-Exchange/lib/ui/widget/currencies-bottom-sheet.widget.dart
import 'package:easy_exchange/ui/widget/currency-rates-list.widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; typedef void StringCallback(String code, double rate); class CurrenciesBottomSheet extends StatefulWidget { final String baseCurrency; final StringCallback callback; const CurrenciesBottomSheet(this.baseCurrency, this.callback); @override _CurrenciesBottomSheetState createState() => _CurrenciesBottomSheetState(); } class _CurrenciesBottomSheetState extends State<CurrenciesBottomSheet> { @override Widget build(BuildContext context) { return DraggableScrollableSheet( expand: false, initialChildSize: 0.5, minChildSize: 0.1, maxChildSize: 0.9, builder: (_, controller) { return Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(20.0), topRight: Radius.circular(20.0)), ), child: ListView( controller: controller, children: <Widget>[ ListTile( title: Text( 'Select a currency', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24.0), )), CurrencyRateList(widget.baseCurrency, widget.callback) ], ), ); }, ); } }
0
mirrored_repositories/Easy-Exchange/lib/services
mirrored_repositories/Easy-Exchange/lib/services/repository/currency-rates-repository.dart
import 'package:easy_exchange/services/networking/api-provider.dart'; import 'dart:async'; import 'package:easy_exchange/model/currency-rates.dart'; import 'package:intl/intl.dart'; class CurrencyRatesRepository { ApiProvider _provider = ApiProvider(); Future<CurrencyRates> fetchCurrencyRates() async { final response = await _provider.get(""); return CurrencyRates.fromJson(response); } Future<CurrencyRates> fetchBaseCurrencyRates(String baseCurrency) async { final String parameterUrl = "latest?base=" + baseCurrency; final response = await _provider.get(parameterUrl); return CurrencyRates.fromJson(response); } Future<CurrencyRates> fetchSpecificCurrencyRates( String originCurrency, String destinationCurrency) async { final String parameterUrl = "latest?base=" + originCurrency + "&&symbols=" + destinationCurrency; final response = await _provider.get(parameterUrl); return CurrencyRates.fromJson(response); } Future<HistoricalRates> fetchRatesHistory( String originCurrency, String destinationCurrency, DateTime start, DateTime end, ) async { final paramDateFormat = DateFormat("yyyy-MM-dd"); final String parameterUrl = "history?base=" + originCurrency + "&&symbols=" + destinationCurrency + "&&start_at=" + paramDateFormat.format(start) + "&&end_at=" + paramDateFormat.format(end); final response = await _provider.get(parameterUrl); return HistoricalRates.fromJson(response); } }
0
mirrored_repositories/Easy-Exchange/lib/services
mirrored_repositories/Easy-Exchange/lib/services/bloc/currency-rates-history-bloc.dart
import 'dart:async'; import 'package:easy_exchange/services/networking/response.dart'; import 'package:easy_exchange/services/repository/currency-rates-repository.dart'; import 'package:easy_exchange/model/currency-rates.dart'; import 'package:rxdart/subjects.dart'; class CurrencyRatesHistoryListBloc { CurrencyRatesRepository _currencyRatesHistoryListRepository; StreamController _currencyRatesHistoryListController; StreamSink<Response<HistoricalRates>> get currecyRatesListSink => _currencyRatesHistoryListController.sink; Stream<Response<HistoricalRates>> get currencyRatesListStream => _currencyRatesHistoryListController.stream; CurrencyRatesHistoryListBloc() { _currencyRatesHistoryListController = BehaviorSubject<Response<HistoricalRates>>(); _currencyRatesHistoryListRepository = CurrencyRatesRepository(); } fetchCurrencyRatesHistory( String baseCurrency, String destinationCurrency, int days) async { currecyRatesListSink.add(Response.loading('Getting Currency Rates List.')); try { HistoricalRates historicalRates = await _currencyRatesHistoryListRepository .fetchRatesHistory(baseCurrency, destinationCurrency, DateTime.now().subtract(Duration(days: days)), DateTime.now()); currecyRatesListSink.add(Response.completed(historicalRates)); } catch (e) { currecyRatesListSink.add(Response.error(e.toString())); print(e); } } dispose() { _currencyRatesHistoryListController?.close(); } }
0
mirrored_repositories/Easy-Exchange/lib/services
mirrored_repositories/Easy-Exchange/lib/services/bloc/currency-rate-bloc.dart
import 'dart:async'; import 'package:easy_exchange/services/networking/response.dart'; import 'package:easy_exchange/services/repository/currency-rates-repository.dart'; import 'package:easy_exchange/model/currency-rates.dart'; import 'package:rxdart/subjects.dart'; class CurrencyRatesListBloc { CurrencyRatesRepository _currencyRatesListRepository; StreamController _currencyRatesListController; StreamSink<Response<CurrencyRates>> get currecyRatesListSink => _currencyRatesListController.sink; Stream<Response<CurrencyRates>> get currencyRatesListStream => _currencyRatesListController.stream; CurrencyRatesListBloc() { _currencyRatesListController = BehaviorSubject<Response<CurrencyRates>>(); _currencyRatesListRepository = CurrencyRatesRepository(); } fetchBaseCurrencyRates(String baseCurrency) async { currecyRatesListSink.add(Response.loading('Getting Currency Rates List.')); try { CurrencyRates currencyRates = await _currencyRatesListRepository.fetchBaseCurrencyRates(baseCurrency); currecyRatesListSink.add(Response.completed(currencyRates)); } catch (e) { currecyRatesListSink.add(Response.error(e.toString())); print(e); } } dispose() { _currencyRatesListController?.close(); } }
0
mirrored_repositories/Easy-Exchange/lib/services
mirrored_repositories/Easy-Exchange/lib/services/networking/custom-exception.dart
class CustomException implements Exception { final _message; final _prefix; CustomException([this._message, this._prefix]); String toString() { return "$_prefix$_message"; } } class FetchDataException extends CustomException { FetchDataException([String message]) : super(message, "Error During Communication: "); } class BadRequestException extends CustomException { BadRequestException([message]) : super(message, "Invalid Request: "); } class UnauthorisedException extends CustomException { UnauthorisedException([message]) : super(message, "Unauthorised: "); } class InvalidInputException extends CustomException { InvalidInputException([String message]) : super(message, "Invalid Input: "); }
0
mirrored_repositories/Easy-Exchange/lib/services
mirrored_repositories/Easy-Exchange/lib/services/networking/index.dart
export 'api-provider.dart'; export 'custom-exception.dart'; export 'response.dart';
0
mirrored_repositories/Easy-Exchange/lib/services
mirrored_repositories/Easy-Exchange/lib/services/networking/response.dart
class Response<T> { Status status; T data; String message; Response.loading(this.message) : status = Status.LOADING; Response.completed(this.data) : status = Status.COMPLETED; Response.error(this.message) : status = Status.ERROR; @override String toString() { return "Status : $status \n Message : $message \n Data : $data"; } } enum Status { LOADING, COMPLETED, ERROR }
0
mirrored_repositories/Easy-Exchange/lib/services
mirrored_repositories/Easy-Exchange/lib/services/networking/api-provider.dart
import 'package:easy_exchange/services/networking/custom-exception.dart'; import 'package:easy_exchange/util/url.dart'; import 'package:http/http.dart' as http; import 'dart:io'; import 'dart:convert'; import 'dart:async'; class ApiProvider { final String _baseUrl = Url.exchangeBaseUrl; Future<dynamic> get(String url) async { var responseJson; try { final response = await http.get(_baseUrl + url); responseJson = _response(response); } on SocketException { throw FetchDataException('No Internet connection'); } return responseJson; } dynamic _response(http.Response response) { switch (response.statusCode) { case 200: var responseJson = json.decode(response.body); return responseJson; case 400: throw BadRequestException(response.body); case 401: case 403: throw UnauthorisedException(response.body); case 500: default: throw FetchDataException( 'Error occured while Communication with Server with StatusCode : ${response.statusCode}'); } } }
0
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_draw_polyline_between_coordinates_google_map/screen/home_page_screen.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: HomePageScreen(), ); } }
0
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib/widgets/text_button_widget.dart
import 'package:flutter/material.dart'; import 'package:flutter_draw_polyline_between_coordinates_google_map/common/color_constants.dart'; class TextButtonWidget extends StatelessWidget { final String btnTxt; final Color backColor; final Color textColor; final Function btnOntap; const TextButtonWidget({ Key key, @required this.btnTxt, @required this.backColor, @required this.textColor, @required this.btnOntap, }) : super(key: key); @override Widget build(BuildContext context) { double height, width; height = MediaQuery.of(context).size.height; width = MediaQuery.of(context).size.width; return Container( height: 57, width: width * 0.4, decoration: BoxDecoration( color: backColor, borderRadius: BorderRadius.circular(5), border: Border.all( color: ColorConstants.kBlackColor, ), ), child: TextButton( onPressed: btnOntap, child: Center( child: Text( btnTxt, style: Theme.of(context).textTheme.caption.copyWith( fontSize: 16, color: textColor, fontWeight: FontWeight.w600, ), ), ), ), ); } }
0
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib/screen/google_map_screen.dart
import 'package:flutter/material.dart'; import 'package:flutter_draw_polyline_between_coordinates_google_map/common/color_constants.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; /* Title:GoogleMapScreen Purpose:GoogleMapScreen Created By:Kalpesh Khandla */ class GoogleMapScreen extends StatefulWidget { GoogleMapScreen({Key key}) : super(key: key); @override _GoogleMapScreenState createState() => _GoogleMapScreenState(); } class _GoogleMapScreenState extends State<GoogleMapScreen> { double height, width; int amountTxt = 390; String orderNo = "4578178"; String restaurantName = "FoodiePie Restaurants"; String addressTxt = "B-2024, Silver Corner, Ahmedabad"; GoogleMapController mapController; double _originLatitude = 23.0284, _originLongitude = 72.5068; double _destLatitude = 23.1013, _destLongitude = 72.5407; Map<MarkerId, Marker> markers = {}; Map<PolylineId, Polyline> polylines = {}; List<LatLng> polylineCoordinates = [ LatLng(23.0284, 72.5068), LatLng(23.0504, 72.4991), LatLng(23.1013, 72.5407), ]; PolylinePoints polylinePoints = PolylinePoints(); BitmapDescriptor sourceIcon; BitmapDescriptor destinationIcon; String googleAPiKey = "YOUR_GOOGLE_API_KEY"; void _onMapCreated(GoogleMapController controller) async { mapController = controller; } _addPolyLine() { PolylineId id = PolylineId("poly"); Polyline polyline = Polyline( polylineId: id, visible: true, color: ColorConstants.kGreyTextColor.withOpacity(0.5), points: polylineCoordinates, ); polylines[id] = polyline; setState(() {}); } _addMarker(LatLng position, String id, BitmapDescriptor descriptor) { MarkerId markerId = MarkerId(id); Marker marker = Marker( markerId: markerId, icon: descriptor, position: position, ); markers[markerId] = marker; } _getPolyline() async { PolylineResult result = await polylinePoints.getRouteBetweenCoordinates( googleAPiKey, PointLatLng(_originLatitude, _originLongitude), PointLatLng(_destLatitude, _destLongitude), travelMode: TravelMode.driving, wayPoints: [ PolylineWayPoint( location: "Sabo, Yaba Lagos Nigeria", ), ]); if (result.points.isNotEmpty) { result.points.forEach((PointLatLng point) { polylineCoordinates.add(LatLng(point.latitude, point.longitude)); }); } _addPolyLine(); } @override void initState() { // TODO: implement initState super.initState(); _addMarker( LatLng(_originLatitude, _originLongitude), "origin", BitmapDescriptor.defaultMarker, ); _addMarker( LatLng(_destLatitude, _destLongitude), "destination", BitmapDescriptor.defaultMarker, ); _getPolyline(); } @override Widget build(BuildContext context) { height = MediaQuery.of(context).size.height; width = MediaQuery.of(context).size.width; return Scaffold( body: SafeArea( child: Stack( children: [ GoogleMap( initialCameraPosition: CameraPosition( target: LatLng(_originLatitude, _originLongitude), zoom: 12, ), myLocationEnabled: true, tiltGesturesEnabled: true, compassEnabled: true, scrollGesturesEnabled: true, zoomGesturesEnabled: true, onMapCreated: _onMapCreated, markers: Set<Marker>.of(markers.values), polylines: Set<Polyline>.of(polylines.values), ), GestureDetector( onTap: () { Navigator.pop(context); }, child: Padding( padding: const EdgeInsets.only( left: 10, top: 15, ), child: Container( height: 50, width: 50, decoration: BoxDecoration( color: ColorConstants.kWhiteColor, borderRadius: BorderRadius.circular(10), ), child: Icon( Icons.chevron_left, color: ColorConstants.kBlackColor, ), ), ), ), Align( alignment: Alignment.bottomCenter, child: Container( height: height * 0.3, decoration: BoxDecoration( color: ColorConstants.kWhiteColor, borderRadius: BorderRadius.only( topLeft: const Radius.circular(20.0), topRight: const Radius.circular(20.0), ), ), child: Padding( padding: const EdgeInsets.only( left: 15, right: 15, top: 20, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "Order ID: #" + orderNo, style: Theme.of(context).textTheme.caption.copyWith( fontSize: 14, fontFamily: "Poppins Regular", color: ColorConstants.kTextColor, ), ), Text( "Total Payment: " + "\u{20B9}" + amountTxt.toString(), style: Theme.of(context).textTheme.caption.copyWith( fontSize: 14, fontFamily: "Poppins Regular", color: ColorConstants.kTextColor, ), ), ], ), SizedBox( height: 10, ), Divider( thickness: 1, color: ColorConstants.kGreyTextColor.withOpacity(0.2), ), Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( children: [ SizedBox( height: 15, ), Container( height: 8, width: 8, decoration: BoxDecoration( color: ColorConstants.kGreenTextColor, borderRadius: BorderRadius.circular(8 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 3, width: 3, decoration: BoxDecoration( color: ColorConstants.kDividerColor, borderRadius: BorderRadius.circular(3 / 2), ), ), SizedBox( height: 5, ), Container( height: 8, width: 8, decoration: BoxDecoration( color: ColorConstants.kGreenTextColor, borderRadius: BorderRadius.circular(8 / 2), ), ), ], ), SizedBox( width: 10, ), Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Pickup Location", style: Theme.of(context) .textTheme .caption .copyWith( fontFamily: "Poppins Regular", fontSize: 14, color: ColorConstants.kHintTextColor, ), ), SizedBox( height: 5, ), Text( restaurantName, style: Theme.of(context) .textTheme .caption .copyWith( fontWeight: FontWeight.w600, fontSize: 14, fontFamily: "Poppins Medium", color: ColorConstants.kTextColor, ), ), SizedBox( height: 25, ), Text( "Drop off Location", style: Theme.of(context) .textTheme .caption .copyWith( fontSize: 14, fontFamily: "Poppins Regular", color: ColorConstants.kHintTextColor, ), ), SizedBox( height: 5, ), Text( addressTxt, style: Theme.of(context) .textTheme .caption .copyWith( fontWeight: FontWeight.w600, fontSize: 14, fontFamily: "Poppins Medium", color: ColorConstants.kTextColor, ), ) ], ), ], ), ], ), ), ), ) ], ), ), ); } }
0
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib/screen/home_page_screen.dart
import 'package:flutter/material.dart'; import 'package:flutter_draw_polyline_between_coordinates_google_map/common/color_constants.dart'; import 'package:flutter_draw_polyline_between_coordinates_google_map/screen/google_map_screen.dart'; import 'package:flutter_draw_polyline_between_coordinates_google_map/widgets/text_button_widget.dart'; class HomePageScreen extends StatelessWidget { const HomePageScreen({Key key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: Center( child: TextButtonWidget( textColor: ColorConstants.kWhiteColor, btnOntap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => GoogleMapScreen(), ), ); }, btnTxt: "Go to Map", backColor: ColorConstants.kBlackColor, ), ), ), ); } }
0
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/lib/common/color_constants.dart
import 'package:flutter/material.dart'; class ColorConstants { static const kPrimaryColor = Color(0XFFFE4040); static const kScreebBackColor = Color(0XFFF7F7F7); static const kTextformHintColor = Color(0XFFB2B2B2); static const kTextColor = Color(0XFF262E3A); static const kfoodItemColor = Color(0XFF1F1F1F); static const kselectedItemColor = Color(0XFFFD8B8B); static const kratingStarColor = Color(0XFFFFBB00); static const ktextFieldBorderColor = Color(0xFFE3E3E3); static const kHintTextColor = Color(0xFFB2B2B2); static const kGreenTextColor = Color(0xFF87B821); static const kGreyTextColor = Color(0xFF707070); static const kExploreTextColor = Color(0xFF2B3849); static const kCardBackColor = Color(0xFF1F1F1F1A); static const kDividerColor = Color(0xFFEFEFEF); static const kitemDividerColor = Color(0xFF000021); static const kHomeScreenBackColor = Color(0xFFF9F9F9); static const kAddRemoveItemColor = Color(0xFFEDF9D3); static const kGreenExploreColor = Color(0xFF37A449); static const kGreyExploreColor = Color(0xFFC48669); static const kExploreItalianColor = Color(0xFFFFC328); static const kExploreThaiColor = Color(0xFFFE8821); static const kOngoingOrderColor = Color(0xFFD5BA0C); static const kDeliveredOrderColor = Color(0xFF03CC03); // Frequently Used Colors static const kWhiteColor = Colors.white; static const kBlackColor = Colors.black; static const kGreyColor = Colors.grey; static const kOrangeColor = Colors.orange; static const kBlueColor = Colors.blue; static const kRedColor = Colors.red; static const kGreenColor = Colors.green; }
0
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map
mirrored_repositories/flutter_draw_polyline_between_two_points_google_map/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_draw_polyline_between_coordinates_google_map/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/24-7-Music-Radio-App
mirrored_repositories/24-7-Music-Radio-App/lib/radio.dart
import 'dart:async'; import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freecodecamp_radio/api_data.dart'; import 'package:freecodecamp_radio/bloc/radio_bloc.dart'; import 'package:freecodecamp_radio/colorpalette.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:just_audio/just_audio.dart'; import 'package:just_audio_background/just_audio_background.dart'; import 'package:window_manager/window_manager.dart'; class RadioPage extends StatefulWidget { final AudioPlayer player; const RadioPage({super.key, required this.player}); @override State<RadioPage> createState() => _RadioPageState(); } class _RadioPageState extends State<RadioPage> { late List<Color> currentPalette = ColorPalette.freecodecamp; final RadioBloc radioBloc = RadioBloc(); @override void initState() { super.initState(); radioBloc.add(RadioFetchEvent()); setNewPalette(); } void setNewPalette(){ setState(() { currentPalette = ColorPalette.getNextColorpalette(currentPalette); SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( systemNavigationBarColor: currentPalette[1], )); }); ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( "${ColorPalette.currentPaletteName(currentPalette)} Theme", style: GoogleFonts.poppins(fontSize: 16, color: currentPalette[3], fontWeight: FontWeight.w500), softWrap: true, overflow: TextOverflow.fade, ), duration: const Duration(seconds: 1), backgroundColor: currentPalette[2], shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), width: 200, margin: const EdgeInsets.all(0), )); if(Platform.isWindows){ windowManager.setBackgroundColor(currentPalette[1]); } } @override Widget build(BuildContext context) { return BlocConsumer<RadioBloc, RadioState>( bloc: radioBloc, listenWhen: (prev, current) => current is RadioActionState, buildWhen: (prev, current) => current is! RadioActionState, listener: (context, state) {}, builder: (context, state) { switch (state.runtimeType) { case RadioFetchSuccessfulState: final success = state as RadioFetchSuccessfulState; return RadioUI( currentPalette: currentPalette, data: success.data, player: widget.player, radioBloc: radioBloc, setNewPalette: (){ setNewPalette(); }, ); default: return Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [currentPalette[0], currentPalette[1]], begin: Alignment.topCenter, end: Alignment.bottomCenter, stops: const [0, 0.95], ), ), child: Center( child: CircularProgressIndicator(color: currentPalette[2]), ), ); } }, ); } } class RadioUI extends StatelessWidget { const RadioUI({ super.key, required this.currentPalette, required this.data, required this.player, required this.radioBloc, required this.setNewPalette, }); final List<Color> currentPalette; final RadioData data; final AudioPlayer player; final RadioBloc radioBloc; final Function setNewPalette; @override Widget build(BuildContext context) { return Scaffold( extendBodyBehindAppBar: true, appBar: AppBar( backgroundColor: const Color.fromARGB(50, 0, 0, 0), elevation: 0, title: const Text("Radio"), titleTextStyle: GoogleFonts.poppins(color: currentPalette[2], fontSize: 24, fontWeight: FontWeight.w600), centerTitle: true, actions: [ IconButton( onPressed: () { setNewPalette(); }, icon: Icon( Icons.color_lens_rounded, size: 24, color: currentPalette[2], ), ), ], ), body: Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [currentPalette[0], currentPalette[1]], begin: Alignment.topCenter, end: Alignment.bottomCenter, stops: const [0, 0.95]), ), child: Column( children: [ Expanded( flex: 3, child: CoverImage( data: data, ), ), const SizedBox( height: 28, ), Expanded( flex: 1, child: PlayingNow( currentPalette: currentPalette, data: data, ), ), Expanded( flex: 1, child: CurrentPlayProgress( currentPalette: currentPalette, data: data, player: player, radioBloc: radioBloc, ), ), Expanded( flex: 1, child: NextPlaying( currentPalette: currentPalette, data: data, ), ), const SizedBox( height: 16, ) ], )), ); } } class CoverImage extends StatelessWidget { const CoverImage({ super.key, required this.data, }); final RadioData data; @override Widget build(BuildContext context) { return Container( height: 400, decoration: BoxDecoration( borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(36), bottomRight: Radius.circular(36)), image: DecorationImage(fit: BoxFit.cover, image: NetworkImage(data.nowPlayingCoverSrc)), boxShadow: const [ BoxShadow( color: Colors.black54, spreadRadius: 1, blurRadius: 10, blurStyle: BlurStyle.normal, offset: Offset(0, 5), ) ], ), ); } } class NextPlaying extends StatelessWidget { const NextPlaying({ super.key, required this.currentPalette, required this.data, }); final RadioData data; final List<Color> currentPalette; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: Container( width: double.infinity, padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: currentPalette[1], borderRadius: BorderRadius.circular(18), boxShadow: const [ BoxShadow( color: Colors.black54, spreadRadius: 1, blurRadius: 10, blurStyle: BlurStyle.normal, offset: Offset(5, 5), ) ], ), child: Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(18), child: Image.network( data.nextPlayingCoverSrc, height: 100, width: 100, ), ), const SizedBox( width: 16, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Playing Next", style: GoogleFonts.poppins(fontSize: 20, color: currentPalette[2], fontWeight: FontWeight.bold), textAlign: TextAlign.start, ), SizedBox( child: Text( "\t\t${data.nextplayingTitle}", style: GoogleFonts.poppins( fontSize: 16, color: currentPalette[3], ), overflow: TextOverflow.fade, textAlign: TextAlign.start, ), ), SizedBox( child: Text( "\t\t${data.nextPlayingArtist}", style: GoogleFonts.poppins(fontSize: 14, color: currentPalette[3]), overflow: TextOverflow.fade, textAlign: TextAlign.start, ), ), ], ) ], ))); } } class PlayingNow extends StatelessWidget { const PlayingNow({ super.key, required this.currentPalette, required this.data, }); final List<Color> currentPalette; final RadioData data; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: Container( width: double.infinity, padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: currentPalette[1], borderRadius: BorderRadius.circular(18), boxShadow: const [ BoxShadow( color: Colors.black54, spreadRadius: 1, blurRadius: 10, blurStyle: BlurStyle.normal, offset: Offset(5, 5), ) ], ), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "\tNow Playing", style: GoogleFonts.poppins(fontSize: 24, color: currentPalette[2], fontWeight: FontWeight.bold), textAlign: TextAlign.start, ), SizedBox( child: Text( "\t\t\t${data.nowplayingTitle}", style: GoogleFonts.poppins( fontSize: 18, color: currentPalette[3], ), overflow: TextOverflow.fade, textAlign: TextAlign.start, ), ), SizedBox( child: Text( "\t\t\t${data.nowPlayingArtist}", style: GoogleFonts.poppins(fontSize: 16, color: currentPalette[3]), overflow: TextOverflow.fade, textAlign: TextAlign.start, ), ), ], ), ), ); } } class CurrentPlayProgress extends StatefulWidget { const CurrentPlayProgress({ super.key, required this.currentPalette, required this.data, required this.player, required this.radioBloc, }); final List<Color> currentPalette; final RadioData data; final AudioPlayer player; final RadioBloc radioBloc; @override State<CurrentPlayProgress> createState() => _CurrentPlayProgressState(); } class _CurrentPlayProgressState extends State<CurrentPlayProgress> { double progressValue = 0.0; int elapsedSeconds = 0; int endDurationInSeconds = 0; // Adjust this based on your requirement late Timer timer; late IconData playIconData; late String playText; @override void initState() { super.initState(); startTimer(); playRadio(); } void playRadio() { widget.player.play(); setState(() { widget.radioBloc.add(RadioFetchEvent()); playIconData = Icons.pause; playText = "Pause"; }); // AudioSource.uri( // Uri.parse("https://coderadio-admin-v2.freecodecamp.org/listen/coderadio/radio.mp3"), // tag: MediaItem( // id: '1', // title: widget.data.nextplayingTitle, // artist: widget.data.nowPlayingArtist, // duration: Duration(seconds: widget.data.totalDur), // artUri: Uri.parse(widget.data.nowPlayingCoverSrc), // ), // ); } void pauseRadio() { widget.player.pause(); setState(() { playIconData = Icons.play_arrow_rounded; playText = "Play"; }); } void startTimer() { elapsedSeconds = widget.data.elapsed; endDurationInSeconds = widget.data.totalDur; const oneSecond = Duration(seconds: 1); timer = Timer.periodic( oneSecond, (Timer timer) { setState(() { widget.radioBloc.add(RadioFetchEvent()); if (elapsedSeconds == endDurationInSeconds) { timer.cancel(); // Stop the timer when the elapsed time reaches the end duration startTimer(); } else { elapsedSeconds++; progressValue = elapsedSeconds / endDurationInSeconds; } }); }, ); } @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: Container( width: double.infinity, padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: widget.currentPalette[1], borderRadius: BorderRadius.circular(18), boxShadow: const [ BoxShadow( color: Colors.black54, spreadRadius: 1, blurRadius: 10, blurStyle: BlurStyle.normal, offset: Offset(5, 5), ) ], ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ const SizedBox( height: 16, ), LinearProgressIndicator( value: progressValue, color: widget.currentPalette[2], borderRadius: BorderRadius.circular(8), minHeight: 8, backgroundColor: widget.currentPalette[0], ), const SizedBox( height: 8, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisSize: MainAxisSize.max, children: [ ElevatedButton.icon( onPressed: () { if (widget.player.playing) { pauseRadio(); } else { playRadio(); } }, style: ButtonStyle(backgroundColor: MaterialStateProperty.all(widget.currentPalette[1])), icon: Icon( playIconData, color: widget.currentPalette[2], size: 36, ), label: Text( playText, style: GoogleFonts.poppins(fontWeight: FontWeight.bold, fontSize: 28, color: widget.currentPalette[3]), )), Container( width: 1, height: 28, decoration: const BoxDecoration(color: Colors.white24), ), ElevatedButton.icon( onPressed: null, style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.transparent)), icon: Icon( Icons.headphones_rounded, color: widget.currentPalette[2], size: 28, ), label: Text( widget.data.totalListeners.toString(), style: GoogleFonts.poppins( color: widget.currentPalette[3], fontWeight: FontWeight.bold, fontSize: 28, ), ), ), ], ) ], ), ), ); } }
0
mirrored_repositories/24-7-Music-Radio-App
mirrored_repositories/24-7-Music-Radio-App/lib/colorpalette.dart
import 'package:flutter/material.dart'; class ColorPalette { static List<Color> retro_1 = [ const Color(0xFF4D4C7D), const Color(0xFF363062), const Color(0xFFF99417), const Color(0xFFF5F5F5), ]; static List<Color> retro_2 = [ const Color(0xFFFCF5ED), const Color(0xFFF4BF96), const Color(0xFFCE5A67), const Color(0xFF1F1717), ]; static List<Color> retro_3 = [ const Color(0xFFEEE2DE), const Color(0xFFEA906C), const Color(0xFFB31312), const Color(0xFF2B2A4C), ]; static List<Color> retro_4 = [ const Color(0xFF4C4C6D), const Color(0xFF1B9C85), const Color(0xFFE8F6EF), const Color(0xFFFFE194), ]; static List<Color> retro_5 = [ const Color(0xFFF9F5EB), const Color(0xFFE4DCCF), const Color(0xFFEA5455), const Color(0xFF002B5B), ]; static List<Color> vintage_1 = [ const Color(0xFFECE3CE), const Color(0xFF739072), const Color(0xFF4F6F52), const Color(0xFF3A4D39), ]; static List<Color> vintage_2 = [ const Color(0xFF132043), const Color(0xFF1F4172), const Color(0xFFF1B4BB), const Color(0xFFFDF0F0), ]; static List<Color> vintage_3 = [ const Color(0xFF252B48), const Color(0xFF445069), const Color(0xFF5B9A8B), const Color(0xFFF7E987), ]; static List<Color> vintage_4 = [ const Color(0xFF393E46), const Color(0xFF6D9886), const Color(0xFFF2E7D5), const Color(0xFFF7F7F7), ]; static List<Color> vintage_5 = [ const Color(0xFF2B3A55), const Color(0xFFCE7777), const Color(0xFFE8C4C4), const Color(0xFFF2E5E5), ]; static List<Color> neon_1 = [ const Color(0xFF27005D), const Color(0xFF9400FF), const Color(0xFFAED2FF), const Color(0xFFE4F1FF), ]; static List<Color> neon_2 = [ const Color(0xFF793FDF), const Color(0xFF7091F5), const Color(0xFF97FFF4), const Color(0xFFFFFD8C), ]; static List<Color> neon_3 = [ const Color(0xFF6F61C0), const Color(0xFFA084E8), const Color(0xFF8BE8E5), const Color(0xFFD5FFE4), ]; static List<Color> neon_4 = [ const Color(0xFF45FFCA), const Color(0xFFFEFFAC), const Color(0xFFFFB6D9), const Color(0xFFD67BFF), ]; static List<Color> freecodecamp = [ const Color(0xFF2a2a40), const Color(0xFF0a0a23), const Color(0xffFeac32), const Color(0xFFf5f6f7), ]; static List<List<Color>> colorpalettes = [ freecodecamp, retro_1, retro_2, retro_3, retro_4, retro_5, vintage_1, vintage_2, vintage_3, vintage_4, vintage_5, neon_1, neon_2, neon_3, neon_4, ]; static List<Color> getNextColorpalette(List<Color> currentPalette) { int index = colorpalettes.indexOf(currentPalette); if (index == -1) { return colorpalettes[0]; } else if (index == colorpalettes.length - 1) { return colorpalettes[0]; } else { return colorpalettes[index + 1]; } } static String currentPaletteName(List<Color> currentPalette) { List<String> colorpaletteNames = [ "freecodecamp", "retro 1", "retro 2", "retro 3", "retro 4", "retro 5", "vintage 1", "vintage 2", "vintage 3", "vintage 4", "vintage 5", "neon 1", "neon 2", "neon 3", "neon 4", ]; int index = colorpalettes.indexOf(currentPalette); if (index != -1) { return colorpaletteNames[index]; } else { return "Some Unknown Colors XD"; } } }
0
mirrored_repositories/24-7-Music-Radio-App
mirrored_repositories/24-7-Music-Radio-App/lib/main.dart
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:freecodecamp_radio/radio.dart'; import 'package:just_audio/just_audio.dart'; import 'package:window_manager/window_manager.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); if (Platform.isAndroid) { await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); } if (Platform.isWindows) { await windowManager.ensureInitialized(); await windowManager.setSize(const Size(430, 932)); await windowManager.setResizable(false); await windowManager.setAspectRatio(9/16); await windowManager.setMaximizable(false); await windowManager.setTitle(""); } final player = AudioPlayer(); await player.setUrl("https://coderadio-admin-v2.freecodecamp.org/listen/coderadio/radio.mp3"); runApp(MainApp( player: player, )); } class MainApp extends StatelessWidget { final AudioPlayer player; const MainApp({super.key, required this.player}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: RadioPage( player: player, ), ); } }
0
mirrored_repositories/24-7-Music-Radio-App
mirrored_repositories/24-7-Music-Radio-App/lib/api_data.dart
class RadioData { final String nowplayingTitle; final String nowPlayingArtist; final String nowPlayingCoverSrc; final String totalListeners; final int totalDur; final int elapsed; final String nextplayingTitle; final String nextPlayingArtist; final String nextPlayingCoverSrc; RadioData( {required this.nowplayingTitle, required this.nowPlayingArtist, required this.nowPlayingCoverSrc, required this.totalListeners, required this.totalDur, required this.elapsed, required this.nextplayingTitle, required this.nextPlayingArtist, required this.nextPlayingCoverSrc}); }
0
mirrored_repositories/24-7-Music-Radio-App/lib
mirrored_repositories/24-7-Music-Radio-App/lib/bloc/radio_event.dart
part of 'radio_bloc.dart'; @immutable sealed class RadioEvent {} class RadioFetchEvent extends RadioEvent{}
0
mirrored_repositories/24-7-Music-Radio-App/lib
mirrored_repositories/24-7-Music-Radio-App/lib/bloc/radio_bloc.dart
import 'dart:async'; import 'dart:developer'; import 'package:bloc/bloc.dart'; import 'package:dio/dio.dart'; import 'package:freecodecamp_radio/api_data.dart'; import 'package:meta/meta.dart'; part 'radio_event.dart'; part 'radio_state.dart'; class RadioBloc extends Bloc<RadioEvent, RadioState> { RadioBloc() : super(RadioInitial()) { on<RadioFetchEvent>(radioFetchEvent); } FutureOr<void> radioFetchEvent(RadioFetchEvent event, Emitter<RadioState> emit) async { RadioData data; try { final response = await Dio(BaseOptions(headers: { "Access-Control-Allow-Origin":"*" })).get("https://coderadio-admin.freecodecamp.org/api/nowplaying"); List<Map<String, dynamic>> radioData = List<Map<String, dynamic>>.from(response.data); data = RadioData( nowplayingTitle: radioData[0]['now_playing']['song']['title'].toString(), nowPlayingArtist: radioData[0]['now_playing']['song']['artist'].toString(), nowPlayingCoverSrc: radioData[0]['now_playing']['song']['art'].toString(), totalListeners: radioData[0]['listeners']['total'].toString(), totalDur: radioData[0]['now_playing']['duration'], elapsed: radioData[0]['now_playing']['elapsed'], nextplayingTitle: radioData[0]['playing_next']['song']['title'].toString(), nextPlayingArtist: radioData[0]['playing_next']['song']['artist'].toString(), nextPlayingCoverSrc: radioData[0]['playing_next']['song']['art'].toString(), ); emit(RadioFetchSuccessfulState(data: data)); } catch (e) { log(e.toString()); } } }
0
mirrored_repositories/24-7-Music-Radio-App/lib
mirrored_repositories/24-7-Music-Radio-App/lib/bloc/radio_state.dart
part of 'radio_bloc.dart'; @immutable sealed class RadioState {} abstract class RadioActionState extends RadioState{} final class RadioInitial extends RadioState {} class RadioFetchSuccessfulState extends RadioState{ final RadioData data; RadioFetchSuccessfulState({required this.data}); }
0
mirrored_repositories/24-7-Music-Radio-App
mirrored_repositories/24-7-Music-Radio-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:freecodecamp_radio/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/CodeQuizzes-App
mirrored_repositories/CodeQuizzes-App/lib/main.dart
import 'package:codequiz/pages/welcome-page.dart'; import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of our application. @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( fontFamily: 'Kufam', primaryColor: Color(0xFF422a3c), visualDensity: VisualDensity.adaptivePlatformDensity, ), home: WelcomePage(), ); } }
0
mirrored_repositories/CodeQuizzes-App/lib
mirrored_repositories/CodeQuizzes-App/lib/database/temp_db.dart
import 'package:codequiz/model/question.dart'; List<Question> questionBank = [ Question( questionText: 'Only character or integer can be used in switch statement', isCorrect: false), Question( questionText: 'The return type of malloc function is void.', isCorrect: false), Question( questionText: 'define is known as preprocessor compiler directive.', isCorrect: true), Question( questionText: 'Algorithm is the graphical representation of logic.', isCorrect: false), Question( questionText: 'The ++ operator increments the operand by 1, whereas, the -- operator decrements it by 1.', isCorrect: true), Question( questionText: 'It is necessary that a loop counter must only be an int. It cannot be a float.', isCorrect: false), Question( questionText: 'sizeof( ) is a function that returns the size of a variable.', isCorrect: false), Question( questionText: 'A zero value is considered to be false and a non-zero value is considered to be true.', isCorrect: true), Question( questionText: '= is used for comparison, whereas, == is used for assignment of two quantities.', isCorrect: false), Question( questionText: 'Blank spaces may be inserted between two words to improve the readability of the statement.', isCorrect: true), Question( questionText: 'The keywords cannot be used as variable names.', isCorrect: true), Question( questionText: 'continue keyword skip one iteration of loop?', isCorrect: true), Question( questionText: 'Switch statement can have any number of case instances', isCorrect: true), Question( questionText: 'Two case constants within the same switch statement can have the same value.', isCorrect: false), Question( questionText: 'ferror( ) reports any error that might have occurred during a read/write operation on a file.', isCorrect: true), Question( questionText: 'A file opened for writing already exists its contents would be overwritten.', isCorrect: true), Question( questionText: 'A do-while loop is used to ensure that the statements within the loop are executed at least twice.', isCorrect: false), Question( questionText: 'Structure is collection of dissimilar data types.', isCorrect: true), Question(questionText: 'In Java arrays are Objects.', isCorrect: true), Question( questionText: 'Passing an array in method , the method receives it as the reference of that array.', isCorrect: true), Question( questionText: 'C99 standard guarantees uniqueness of 12 characters for external names.', isCorrect: false), Question( questionText: 'Names of functions in two different files linked together must be unique.', isCorrect: true), Question( questionText: 'If return type for a function is not specified, it defaults to int', isCorrect: true), Question( questionText: ' % operators has its associativity from right to left.', isCorrect: false), Question( questionText: 'The conversion characters d, i, o, u, and x may be preceded by h in scanf() to indicate A pointer to long', isCorrect: false), Question( questionText: 'printf("\\n"); statement can print "\n" on the screen', isCorrect: true), Question( questionText: 'An array named B in row 7 column 3 stored B[7,3].', isCorrect: false), Question( questionText: ' While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.', isCorrect: false), Question( questionText: ' A text stream is an ordered sequence of characters composed into lines, each line consisting of zero or more characters plus a terminating new-line character.', isCorrect: true), Question( questionText: 'Offset used in fseek() function call can be a negative number.', isCorrect: true), Question( questionText: 'We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind()', isCorrect: true), Question( questionText: 'In a call to printf() function the format specifier %b can be used to print binary equivalent of an integer.', isCorrect: false), Question( questionText: 'A function may have any number of return statements each returning different values.', isCorrect: true), Question( questionText: 'Names of functions in two different files linked together must be unique', isCorrect: true), Question( questionText: ' A function cannot be defined inside another function', isCorrect: true), Question( questionText: 'Functions cannot return more than one value at a time', isCorrect: true), Question( questionText: 'If return type for a function is not specified, it defaults to int', isCorrect: true), Question( questionText: 'In C all functions except main() can be called recursively.', isCorrect: false), Question( questionText: 'Functions can be called either by value or reference', isCorrect: true), Question( questionText: 'Programmers use a variety of special languages, called programming languages, to communicate with the computer.', isCorrect: true), Question( questionText: 'The assembly languages represent the only way to communicate directly with the computer.', isCorrect: false), Question( questionText: 'High-level languages are a vast improvement over machine and assembly languages because they allow the programmer to use instructions that more closely resemble the English language.', isCorrect: true), Question( questionText: 'When writing a procedure-oriented program, the programmer concentrates on the major tasks that the program needs to perform.nb', isCorrect: true), Question( questionText: 'When used in a program, the repetition structure directs the computer to repeat one or more instructions until some condition is met. ', isCorrect: true), Question( questionText: 'Programs written in a high-level language can be used in many different types of computers. ', isCorrect: true), Question( questionText: 'You can find the sequence structure in every program.', isCorrect: true), Question( questionText: 'Desk-checking is also called pencil-tracing. ', isCorrect: false), Question( questionText: 'Eliminating errors at the pencil and paper stage makes it much easier to produce a correct program in the later steps of the problem-solving process.', isCorrect: true), Question( questionText: 'When creating a computer solution to a problem, the first three steps of the problem-solving process can usually be skipped.', isCorrect: false), Question( questionText: 'After creating the program, the programmer desk-checks the program; this is the sixth step in the problem-solving process for creating a computer program. ', isCorrect: false), Question( questionText: 'Most algorithms begin with an instruction that enters the input items into the computer.', isCorrect: true), Question( questionText: 'Pseudocode is standardized among programmers. ', isCorrect: false), Question( questionText: 'When planning an algorithm, you need to create both a flowchart and pseudocode. ', isCorrect: false), Question( questionText: 'You desk-check an algorithm to verify that it is not missing any steps and that the existing steps are correct and in the proper order.', isCorrect: true), Question( questionText: 'Before you begin the desk-check, you first choose a set of sample data for the input values, which you then use to manually compute the expected output values. ', isCorrect: true), Question( questionText: 'Before you begin the desk-check, you first choose a set of sample data for the input values, which you then use to manually compute the expected output values. ', isCorrect: true), Question( questionText: 'Programmers typically desk-check a program using the same sample data used to desk-check the algorithm. ', isCorrect: true), Question( questionText: 'In most programming languages, the names of processing items can contain letters, numbers, underscores, punctuation characters or spaces. ', isCorrect: false), Question( questionText: 'You should perform several desk-checks, using different data, to make sure that the program is correct. ', isCorrect: true), Question( questionText: 'Errors in a program are called hacks. ', isCorrect: false), Question( questionText: 'Logic errors are easier to find than syntax errors. ', isCorrect: false), Question( questionText: 'The file containing the source code is called the source file. ', isCorrect: true), Question(questionText: 'Comments are statements in C++. ', isCorrect: false), Question(questionText: 'Names in C++ are case sensitive. ', isCorrect: true), Question( questionText: 'The binary number system uses only the two digits 0 and 1. ', isCorrect: true), Question( questionText: 'Variables declared using the string data type usually are initialized to the empty string. ', isCorrect: true), Question( questionText: 'The C++ compiler treats all numeric literal constants containing a decimal place as a double data type.', isCorrect: true), Question( questionText: 'A data type ranks higher than another data type if it can store larger numbers. ', isCorrect: true), Question( questionText: 'A variable can store only one value at a time. ', isCorrect: true), Question( questionText: 'If an expression contains more than one operator having the same priority, those operators are evaluated from right to left. ', isCorrect: false), Question( questionText: 'The newline character in C++ is "\\N". ', isCorrect: false), Question( questionText: 'You use the selection structure when you want a program to make a decision or comparison and then select one of two paths, depending on the result of that decision or comparison. ', isCorrect: true), Question( questionText: 'And if selection structure contains two sets of instructions: one set is processed when the condition is true and the other set is processed when the condition is false. ', isCorrect: false), Question( questionText: 'In C++, you use the if statement to code the if and if/else forms of the selection structure. ', isCorrect: true), Question( questionText: 'In C++, you can have an else clause without matching the if clause. ', isCorrect: false), Question( questionText: 'In C++, comparisons with a precedence number of 2 are performed before comparisons with a precedence number of 1. ', isCorrect: false), Question( questionText: 'You should never use the equality operator to compare two floating-point numbers. ', isCorrect: true), Question( questionText: 'Programmers use a variety of special languages, called programming languages, to communicate with the computer.', isCorrect: true ), Question( questionText: 'The assembly languages represent the only way to communicate directly with the computer.', isCorrect: false ), Question( questionText: 'When writing a procedure-oriented program, the programmer concentrates on the major tasks that the program needs to perform.', isCorrect: true ), Question( questionText: 'When writing a procedure-oriented program, the programmer concentrates on the major tasks that the program needs to perform.', isCorrect: true ), Question( questionText: 'Programs written in a high-level language can be used in many different types of computers. ', isCorrect: true ), Question( questionText: 'You can find the sequence structure in every program. ', isCorrect: true ), Question( questionText: 'Desk-checking is also called pencil-tracing. ', isCorrect: false ), Question( questionText: 'Pseudocode is standardized among programmers. ', isCorrect: false ), Question( questionText: 'When planning an algorithm, you need to create both a flowchart and pseudocode. ', isCorrect: false ), Question( questionText: 'A class definition contains two sections: a declaration section and an optional implementation section. ', isCorrect: true ), Question( questionText: 'Class names in C++ must use the Pascal case. ', isCorrect: false ), Question( questionText: 'The data type and position of each formal parameter in the parameterList of a function call must agree with the data type and position of its corresponding actual argument. ', isCorrect: true ), Question( questionText: 'Few C++ programmers enter the function definitions below the main() function in a program. ', isCorrect: false ), Question( questionText: 'Large and complex programs are typically written by a team of programmers. ', isCorrect: true ), Question( questionText: 'You can use program-defined functions to replace the main() function. ', isCorrect: false ), Question( questionText: 'There are no differences between the syntax of a value-returning function and the syntax of a void function. ', isCorrect: false ), Question( questionText: 'A function header is considered a statement in C++. ', isCorrect: false ), Question( questionText: 'Unless specified otherwise, scalar variables in C++ are passed by reference. ', isCorrect: false ), Question( questionText: 'Passing an array by reference is more efficient than passing it by value. ', isCorrect: true ), Question( questionText: 'All objects in C++ are created from a class and are referred to as children of the class. ', isCorrect: false ), Question( questionText: 'Sequential access files must use the "txt" filename extension. ', isCorrect: false ), Question( questionText: 'The ability to use an object for more than one purpose saves programming time and money—an advantage that contributes to the popularity of object-oriented programming. ', isCorrect: true ), Question( questionText: 'The top-down design divides a problem into one or more objects. ', isCorrect: false ), Question( questionText: 'The objects used in an object-oriented program can take on many different forms. ', isCorrect: true ), ];
0
mirrored_repositories/CodeQuizzes-App/lib
mirrored_repositories/CodeQuizzes-App/lib/pages/home-page.dart
import 'package:codequiz/database/temp_db.dart'; import 'package:flutter/material.dart'; import 'package:codequiz/pages/developer_page.dart'; class MyHomePage extends StatefulWidget { @override _MyHomePage createState() => _MyHomePage(); } class _MyHomePage extends State<MyHomePage> { int _currentIndex = 0; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Color(0xFF442C3E), title: Text( 'CodeQuiz', style: TextStyle( fontSize: 30, fontWeight: FontWeight.bold, fontFamily: 'Ubuntu', ), ), centerTitle: true, elevation: 19, actions: [ IconButton( icon: Icon(Icons.developer_board_outlined), onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => DevelopersPage())); }) ], ), body: OrientationBuilder(builder: (context, orientation) { if (orientation == Orientation.portrait) { return Container( color: Color(0xFFFCFFCE), child: SafeArea( child: Builder( builder: (BuildContext context) => Container( child: ListView( children: [ Container( child: Center( child: Image.asset( 'images/coder.png', height: MediaQuery.of(context).size.height * .4, width: MediaQuery.of(context).size.width * .7, ), ), ), question(), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ preQuestion(), chechkAnswerTrue(context), checkAnswerFalse(context), nextQuestion(), ], ), Spacer(), ], ), ), ), )); } else { return landscape(); } } ) ); } Widget landscape() { return Center( child: Container( color: Color(0xFFFCFFCE), child: SafeArea( child: Builder( builder: (BuildContext context) => Container( child: ListView( children: [ // Container( // child: Center( // child: Image.asset( // 'images/coder.png', // height: MediaQuery.of(context).size.height * .6, // width: MediaQuery.of(context).size.width * .7, // ), // ), // ), // <<============ QUESTION BOX =============>>> Padding( padding: EdgeInsets.only( top: MediaQuery.of(context).size.height * 0.05, left: MediaQuery.of(context).size.height * 0.2, right: MediaQuery.of(context).size.height * 0.3, bottom: MediaQuery.of(context).size.height * 0.08, ), child: Container( decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(4, 5), blurRadius: 17, color: Color(0xFFb36349), spreadRadius: 1.4, ) ], color: Color(0xFFb3635b), borderRadius: BorderRadius.circular(20.0), border: Border.all( // style: BorderStyle.solid, color: Color(0xFFb3635b), )), height: MediaQuery.of(context).size.height * 0.4, width: MediaQuery.of(context).size.width * 0.3, child: Center( child: Padding( padding: EdgeInsets.only(right: 30, left: 30), child: Text( questionBank[_currentIndex % questionBank.length] .questionText, style: TextStyle( fontFamily: 'Ubuntu', color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold, ), ), )), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ preQuestion(), chechkAnswerTrue(context), checkAnswerFalse(context), nextQuestion(), ], ), ], ), ), ), ) ) ); } // <<<========== QUESTION BOX ==========>>> Padding question() { return Padding( padding: EdgeInsets.only(top: 8, left: 30, right: 30, bottom: 38), child: Container( decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(4, 5), blurRadius: 17, color: Color(0xFFb36349), spreadRadius: 1.4, ) ], color: Color(0xFFb3635b), borderRadius: BorderRadius.circular(20.0), border: Border.all( // style: BorderStyle.solid, color: Color(0xFFb3635b), )), height: MediaQuery.of(context).size.height * 0.23, child: Center( child: Padding( padding: EdgeInsets.all(10.0), child: Text( questionBank[_currentIndex % questionBank.length].questionText, style: TextStyle( fontFamily: 'Ubuntu', color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold, ), ), ) ), ), ); } // <<<========== PRE QUESTION ==========>>> Container preQuestion() { return Container( height: 40, decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(5, 6), blurRadius: 10, color: Color(0xFFA0766E), spreadRadius: 2, ) ], borderRadius: BorderRadius.circular(0.0), border: Border.all( // style: BorderStyle.solid, color: Colors.white24, )), child: RaisedButton( color: Color(0xFF494b68), onPressed: () { setState(() { _currentIndex--; }); }, child: Icon( Icons.arrow_left, color: Colors.white, ), ), ); } // <<<========== TRUE ANSWER ==========>>> Container chechkAnswerTrue(BuildContext context) { return Container( height: 40, decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(2, 5), blurRadius: 10, color: Color(0xFFA0766E), spreadRadius: 2) ], borderRadius: BorderRadius.circular(0.0), border: Border.all( // style: BorderStyle.solid, color: Colors.white24, )), child: Container( child: RaisedButton( color: Color(0xFF494b68), onPressed: () => _checkAnswer(true, context), child: Text( 'TRUE', style: TextStyle( color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.bold, ), ), ), ), ); } // <<<========== FALSE ANSWER ==========>>> Container checkAnswerFalse(BuildContext context) { return Container( height: 40, decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(2, 5), blurRadius: 10, color: Color(0xFFA0766E), spreadRadius: 2) ], borderRadius: BorderRadius.circular(0.0), border: Border.all( // style: BorderStyle.solid, color: Colors.white24, )), child: RaisedButton( color: Color(0xFF494b68), onPressed: () => _checkAnswer(false, context), child: Text( 'FALSE', style: TextStyle( color: Colors.white, fontSize: 19.0, fontWeight: FontWeight.bold, ), ), ), ); } // <<<========== NEXT QUESTION ==========>>> Container nextQuestion() { return Container( height: 40, decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(2, 5), blurRadius: 10, color: Color(0xFFA0766E), spreadRadius: 2) ], borderRadius: BorderRadius.circular(0.0), border: Border.all( // style: BorderStyle.solid, color: Colors.white24, )), child: RaisedButton( color: Color(0xFF494b68), onPressed: () { setState(() { _currentIndex++; }); }, child: Icon( Icons.arrow_right, color: Colors.white, ) ), ); } // <<<========== STATE CHECK (ANSWER ANALYSIS SECTION) ==========>>> _checkAnswer(bool ansChoice, BuildContext context) { if (ansChoice == questionBank[_currentIndex].isCorrect) { setState(() { _currentIndex = (_currentIndex + 1) % questionBank.length; }); debugPrint('yes correct'); final snackBar = SnackBar( backgroundColor: Colors.green.withOpacity(0.9), duration: Duration(milliseconds: 500), content: Text('Correct', style: TextStyle( fontSize: 20, letterSpacing: 1, fontFamily: 'Kufam', fontWeight: FontWeight.w400)), ); Scaffold.of(context).showSnackBar(snackBar); } else { debugPrint('incorrect'); final snackBar = SnackBar( backgroundColor: Colors.red.withOpacity(0.9), duration: Duration(milliseconds: 500), content: Text('Wrong', style: TextStyle( fontSize: 20, letterSpacing: 1, fontFamily: 'Kufam', fontWeight: FontWeight.w400, )), ); Scaffold.of(context).showSnackBar(snackBar); } } }
0
mirrored_repositories/CodeQuizzes-App/lib
mirrored_repositories/CodeQuizzes-App/lib/pages/developer_page.dart
import 'dart:ui'; import 'package:codequiz/pages/home-page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:url_launcher/url_launcher.dart'; class DevelopersPage extends StatefulWidget { @override _DevelopersPageState createState() => _DevelopersPageState(); } class _DevelopersPageState extends State<DevelopersPage> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFFFFFFFF), body: OrientationBuilder(builder: (context, orientation) { if (orientation == Orientation.portrait) { return ListView( children: [ Container( child: Stack( children: [ Container( width: MediaQuery.of(context).size.width * 2, height: MediaQuery.of(context).size.height * .5, child: Image.asset( "images/dev.jpg", fit: BoxFit.cover, ), ), Positioned( top: 10, left: 10, child: IconButton( color: Colors.black, icon: Icon(Icons.arrow_back_ios), onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MyHomePage())); }), ), ], ), ), SizedBox( height: MediaQuery.of(context).size.height * 0.02, ), Padding( padding: const EdgeInsets.all(8.0), child: Container( decoration: BoxDecoration( color: Color(0xFF442C3E), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(20), topRight: Radius.circular(20), ), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.4), spreadRadius: 1.4, blurRadius: 10, offset: Offset(0, 7), ) ]), margin: EdgeInsets.only( right: MediaQuery.of(context).size.width * .1, left: MediaQuery.of(context).size.width * .1, ), height: MediaQuery.of(context).size.height * 0.1, width: MediaQuery.of(context).size.width * 0.1, alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Icon( Icons.developer_board, color: Color(0xFFf7e1ed), size: 32, ), Text( "Developers", style: TextStyle( color: Color(0xFFf7e1ed), fontFamily: "Ubuntu", fontSize: 22, fontWeight: FontWeight.bold, ), ), ], ), ), ), SizedBox( height: MediaQuery.of(context).size.height * 0.02, ), Container( child: Padding( padding: const EdgeInsets.only(left: 30, right: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ IconButton( icon: Icon( FontAwesomeIcons.facebook, color: Colors.blue, size: 40, ), onPressed: _launchFB, ), IconButton( icon: Icon( FontAwesomeIcons.twitter, color: Colors.blue[400], size: 40, ), onPressed: _launchTwitter, ), IconButton( icon: Icon( FontAwesomeIcons.linkedin, color: Colors.blue, size: 40, ), onPressed: _launchLinkedIn, ), ], ), ) ), SizedBox( height: MediaQuery.of(context).size.height * 0.13, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ RichText( text: TextSpan( text: ' Developed by' '\n' 'The Geeks of ', style: TextStyle( letterSpacing: 1.6, height: 1.3, fontFamily: 'Ubuntu', fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xFF442C3E)), children: <TextSpan>[ TextSpan( text: 'RippleBee', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20)), ], ), ) ], ), ], ); } else { return ListView( children: [ Container( child: Stack( children: [ Container( width: MediaQuery.of(context).size.width * 1, height: MediaQuery.of(context).size.height * .5, child: Image.asset( "images/dev.jpg", fit: BoxFit.cover, ), ), Positioned( top: 10, left: 10, child: IconButton( color: Colors.black, icon: Icon(Icons.arrow_back_ios), onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MyHomePage())); }), ), ], ), ), SizedBox( height: MediaQuery.of(context).size.height * 0.03, ), Padding( padding: const EdgeInsets.all(8.0), child: Container( decoration: BoxDecoration( color: Color(0xFF442C3E), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(20), topRight: Radius.circular(20), ), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.4), spreadRadius: 1.4, blurRadius: 10, offset: Offset(0, 7), ) ]), margin: EdgeInsets.only( right: MediaQuery.of(context).size.height * .4, left: MediaQuery.of(context).size.height * .4, ), height: MediaQuery.of(context).size.height * .2, width: MediaQuery.of(context).size.width * .1, alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.developer_board, color: Color(0xFFf7e1ed), size: 32, ), SizedBox( width: MediaQuery.of(context).size.width * 0.03, ), Text( "Developers", style: TextStyle( color: Color(0xFFf7e1ed), fontFamily: "Ubuntu", fontSize: 22, fontWeight: FontWeight.bold, ), ), ], ), ), ), SizedBox( height: MediaQuery.of(context).size.height * 0.02, ), Container( child: Padding( padding: const EdgeInsets.only(left: 30, right: 30), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ IconButton( icon: Icon( FontAwesomeIcons.facebook, color: Colors.blue, size: 40, ), onPressed: _launchFB, ), IconButton( icon: Icon( FontAwesomeIcons.twitter, color: Colors.blue[400], size: 40, ), onPressed: _launchTwitter, ), IconButton( icon: Icon( FontAwesomeIcons.linkedin, color: Colors.blue, size: 40, ), onPressed: _launchLinkedIn, ), ], ), ) ), SizedBox( height: MediaQuery.of(context).size.height * 0.12, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ RichText( text: TextSpan( text: ' Developed by' '\n' 'The Geeks of ', style: TextStyle( letterSpacing: 1.6, height: 1.3, fontFamily: 'Ubuntu', fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xFF442C3E)), children: <TextSpan>[ TextSpan( text: 'RippleBee', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20)), ], ), ) ], ), SizedBox( height: 20, ), ], ); } } ) ); } } _launchTwitter() async { const url = 'https://www.twitter.com/@rippledevs'; if (await canLaunch(url)) { await launch(url); } else { throw 'Could not launch $url'; } } _launchFB() async { const url = 'https://www.facebook.com/rippledevs'; if (await canLaunch(url)) { await launch(url); } else { throw 'Could not launch $url'; } } _launchLinkedIn() async { const url = 'https://www.linkedin.com/company/ripplebee/'; if (await canLaunch(url)) { await launch(url); } else { throw 'Could not launch $url'; } }
0
mirrored_repositories/CodeQuizzes-App/lib
mirrored_repositories/CodeQuizzes-App/lib/pages/welcome-page.dart
import 'package:codequiz/pages/home-page.dart'; import 'package:flutter/material.dart'; class WelcomePage extends StatefulWidget { @override _WelcomePageState createState() => _WelcomePageState(); } class _WelcomePageState extends State<WelcomePage> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFF442C3E), body: OrientationBuilder(builder: (context, orientation) { if (orientation == Orientation.portrait) { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( height: MediaQuery.of(context).size.height * 0.25, width: MediaQuery.of(context).size.width * 0.75, child: Center( child: Text( 'Test your programming and coding skills with quizzes and prepare yourself for the job interview! ', textAlign: TextAlign.center, style: TextStyle( fontFamily: 'Lato', letterSpacing: 1.3, color: Colors.white, fontSize: 23, fontWeight: FontWeight.w600), ), ), ), SizedBox( height: MediaQuery.of(context).size.height * .05, ), GestureDetector( child: Center( child: Container( height: MediaQuery.of(context).size.height * 0.12, width: MediaQuery.of(context).size.width * 0.7, decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(20), topRight: Radius.circular(20), ), boxShadow: [ BoxShadow( color: Color(0xFF442C3E).withOpacity(0.1), spreadRadius: 10, blurRadius: 15, offset: Offset(5, 3)) ], color: Color(0xFFf7e1ed), ), child: Center( child: Text( 'Start Quiz', style: TextStyle( fontFamily: 'Ubuntu', fontWeight: FontWeight.bold, fontSize: 40, color: Color(0xFF442C3E), ), ), ), ), ), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MyHomePage())); } ), ], ); } else { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( height: MediaQuery.of(context).size.height * 0.2, width: MediaQuery.of(context).size.width * 0.7, child: Center( child: Text( 'Test your programming and coding skills with quizzes and prepare yourself for the job interview! ', textAlign: TextAlign.center, style: TextStyle( fontFamily: 'Lato', letterSpacing: 1.3, color: Colors.white, fontSize: 23, fontWeight: FontWeight.w600), ), ), ), SizedBox( height: MediaQuery.of(context).size.height * .1, ), GestureDetector( child: Center( child: Container( height: MediaQuery.of(context).size.height * 0.2, width: MediaQuery.of(context).size.width * 0.4, decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(20), topRight: Radius.circular(20), ), boxShadow: [ BoxShadow( color: Color(0xFF442C3E).withOpacity(0.1), spreadRadius: 10, blurRadius: 15, offset: Offset(5, 3)) ], color: Color(0xFFf7e1ed), ), child: Center( child: Text( 'Start Quiz', style: TextStyle( fontFamily: 'Ubuntu', fontWeight: FontWeight.bold, fontSize: 40, color: Color(0xFF442C3E), ), ), ), ), ), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MyHomePage())); } ), ], ) ); } } ) ); } }
0
mirrored_repositories/CodeQuizzes-App/lib
mirrored_repositories/CodeQuizzes-App/lib/model/question.dart
class Question { String questionText; bool isCorrect; Question( { this.questionText, this.isCorrect } ); }
0
mirrored_repositories/CodeQuizzes-App/lib
mirrored_repositories/CodeQuizzes-App/lib/model/utils.dart
import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class Utils { static Future openLink({@required String url}) => _lunchUrl(url); static Future _lunchUrl(String url) async { if (await canLaunch(url)) { await launch(url); } } }
0
mirrored_repositories/CodeQuizzes-App
mirrored_repositories/CodeQuizzes-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:codequiz/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