repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/Blue-Waves-Flutter/lib/generated
mirrored_repositories/Blue-Waves-Flutter/lib/generated/intl/messages_all.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that looks up messages for specific locales by // delegating to the appropriate library. // Ignore issues from commonly used lints in this file. // ignore_for_file:implementation_imports, file_names, unnecessary_new // ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering // ignore_for_file:argument_type_not_assignable, invalid_assignment // ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases // ignore_for_file:comment_references import 'dart:async'; import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; import 'package:intl/src/intl_helpers.dart'; import 'messages_el.dart' as messages_el; import 'messages_en.dart' as messages_en; typedef Future<dynamic> LibraryLoader(); Map<String, LibraryLoader> _deferredLibraries = { 'el': () => new Future.value(null), 'en': () => new Future.value(null), }; MessageLookupByLibrary? _findExact(String localeName) { switch (localeName) { case 'el': return messages_el.messages; case 'en': return messages_en.messages; default: return null; } } /// User programs should call this before using [localeName] for messages. Future<bool> initializeMessages(String localeName) async { var availableLocale = Intl.verifiedLocale( localeName, (locale) => _deferredLibraries[locale] != null, onFailure: (_) => null); if (availableLocale == null) { return new Future.value(false); } var lib = _deferredLibraries[availableLocale]; await (lib == null ? new Future.value(false) : lib()); initializeInternalMessageLookup(() => new CompositeMessageLookup()); messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); return new Future.value(true); } bool _messagesExistFor(String locale) { try { return _findExact(locale) != null; } catch (e) { return false; } } MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); if (actualLocale == null) return null; return _findExact(actualLocale); }
0
mirrored_repositories/Blue-Waves-Flutter/lib
mirrored_repositories/Blue-Waves-Flutter/lib/api/api_service.dart
import 'package:blue_waves/constants.dart'; import 'package:blue_waves/models/beach.dart'; import 'package:blue_waves/models/favorite.dart'; import 'package:blue_waves/models/member.dart'; import 'package:blue_waves/models/photo.dart'; import 'package:blue_waves/models/rating.dart'; import 'package:dio/dio.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; class Api { factory Api() { return instance; } static final Api instance = Api._internal(); Api._internal(); /// Returns all beaches. Future<List<Beach>> getAllBeaches() async { List<dynamic> response; try { response = await Supabase.instance.client.from('beaches').select(); if (response.isEmpty) { return []; } return List<Beach>.generate( response.length, (index) => Beach.fromMap(response[index]), ); } on DioError catch (e) { log.e(e.message); return <Beach>[]; } } /// Returns a beach with the provided [id]. Future<Beach?> getBeach({required String id}) async { PostgrestResponse<dynamic> response; try { response = await Supabase.instance.client.from('beaches').select().eq('id', id); return Beach.fromMap(response.data['results']); } on DioError catch (e) { log.e(e.message); return null; } } /// Searches a beach with [name] Future<List<Beach>> searchBeach({required String name}) async { PostgrestResponse<dynamic> response; try { response = await Supabase.instance.client.from('beaches').select().like( 'normalized_name', '%$name%', ); log.wtf( response.data.length, ); return List<Beach>.generate( response.data.length, (index) => Beach.fromMap( response.data[index], ), ); } on DioError catch (e) { log.e(e.message); return []; } } /// Registers the user in Firebase so as to Supabase. Future<String?> registerUser(Member user) async { final userCredential = await FirebaseAuth.instance.createUserWithEmailAndPassword( email: user.email!, password: user.password!, ); PostgrestResponse<dynamic> response; try { response = await Supabase.instance.client.from('members').insert({ 'externalId': userCredential.user!.uid, 'username': user.displayName, 'email': user.email, }); return response.data['createdAt']; } on DioError catch (e) { log.e(e.message); return e.message; } } /// Starts Google Auth registration. Future<String?> registerGoogleUser({ required String id, required String displayName, }) async { PostgrestResponse<dynamic> response; try { response = await Supabase.instance.client.from('members').insert({ 'externalId': id, 'username': displayName, 'email': displayName, }); log.wtf(response.data); return 'ok'; } on DioError catch (e) { log.e(e.message); return e.message; } } /// Check if the user is already registered. Future<bool> checkUser(String email) async { List<dynamic> response; try { response = await Supabase.instance.client .from('members') .select() .eq('email', email); if (response.isEmpty) { return false; } return true; } on DioError catch (e) { log.e(e.message); return false; } } /// Checks whether the user with [email] has already rated Future<bool> checkRating(String email, int beachId) async { PostgrestResponse<dynamic> response; try { response = await Supabase.instance.client .from('ratings') .select() .eq('member', email) .eq('beach', beachId); if (response.data == null || response.data.isEmpty) { return true; } return false; } on DioError catch (e) { log.e(e.message); return true; } } /// Adds a new rating for the Beach. /// /// [Rating] has required [beach] id, [rating] & [userMail]. Future<String?> addRating(Rating rating) async { PostgrestResponse<dynamic> response; if (await checkRating(rating.userMail, rating.beachId)) { try { response = await Supabase.instance.client.from('ratings').insert({ 'beach': rating.beachId, 'member': rating.userMail, 'rating': rating.rating, 'review': rating.review, }); log.wtf(response.data); return response.data.first['created_at']; } on DioError catch (e) { log.e(e.message); return e.message; } } log.wtf('User has already rated this beach'); return ''; } /// Checks whether the user with [email] has already the beach with ID [beachId] /// /// at his favorites list. Future<bool> checkFavorite(String email, int beachId) async { PostgrestResponse<dynamic> response; try { response = await Supabase.instance.client .from('favorites') .select() .eq('member', email) .eq('beach', beachId); if (response.data == null || response.data.isEmpty) { return true; } return false; } on DioError catch (e) { log.e(e.message); return true; } } /// Adds a beach in favorites list. /// /// [Favorite] has required [beach] id & [userMail]. Future<String?> addFavorite(Favorite favorite) async { PostgrestResponse<dynamic> response; if (await checkFavorite(favorite.userMail, favorite.beachId)) { try { response = await Supabase.instance.client.from('favorites').insert({ 'beach': favorite.beachId, 'member': favorite.userMail, }); log.wtf(response.data); return response.data.first['created_at']; } on DioError catch (e) { log.e(e.message); return e.message; } } log.wtf('User has already favorited this beach'); return ''; } /// Returns all the images associated with a beach with ID [id] /// /// If there are no results an empty `List` is returned. Future<List<Photo>> getImages(int id) async { PostgrestResponse<dynamic> response; try { response = await Supabase.instance.client .from('images') .select() .eq('beach', id); log.wtf(response.data); if (response.data == null || response.data.isEmpty) { return []; } return List<Photo>.generate( response.data.length, (index) => Photo.fromJson( response.data[index], ), ); } on DioError catch (e) { log.e(e.message); return []; } } }
0
mirrored_repositories/vid_player
mirrored_repositories/vid_player/lib/main.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import './providers/video_manager.dart'; import './models/styles.dart'; import './screens/all_videos_screen.dart'; import './screens/settings_screen.dart'; import './screens/video_screen.dart'; import './helpers/dark_theme_provider.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); runApp(VidPlayerApp()); } class VidPlayerApp extends StatefulWidget { @override _VidPlayerAppState createState() => _VidPlayerAppState(); } class _VidPlayerAppState extends State<VidPlayerApp> { DarkThemeProvider _themeProvider = DarkThemeProvider(); @override void initState() { super.initState(); _getCurrentAppTheme(); } //this will get the app current theme as saved in the shared pref file void _getCurrentAppTheme() async { _themeProvider.darkTheme = await _themeProvider.darkThemePreference.getTheme(); } @override Widget build(BuildContext context) { return MultiProvider( providers: [ ChangeNotifierProvider( create: (ctx) => _themeProvider, ), ChangeNotifierProvider( create: (ctx) => VideoManager(), ), ], child: Consumer<DarkThemeProvider>( builder: (_, themeProvider, __) => MaterialApp( title: 'Video Player', theme: Styles.themeData(themeProvider.darkTheme, context), home: AllVideosScreen(), routes: { SettingsScreen.routeName: (ctx) => SettingsScreen(), VideoScreen.routeName: (ctx) => VideoScreen(), }, debugShowCheckedModeBanner: false, ), ), ); } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/widgets/all_videos_grid.dart
import 'package:flutter/material.dart'; import 'package:photo_manager/photo_manager.dart'; import 'package:shimmer/shimmer.dart'; import '../widgets/option_list.dart'; import '../screens/video_screen.dart'; import '../models/video.dart'; ///[AllVideosGrid] displays all videos on device class AllVideosGrid extends StatelessWidget { final List<AssetEntity> mediaList; final List<Video> videoList; // final List<Uint8List> imageList; AllVideosGrid({ @required this.mediaList, @required this.videoList, // @required this.imageList, }); //opens a bottom sheet to get video options void _openBottomSheet(BuildContext ctx, Video video) { showModalBottomSheet( shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.0), ), ), context: ctx, builder: (_) { return GestureDetector( child: OptionList( mVideo: video, //image: image, ), onTap: () {}, behavior: HitTestBehavior.opaque, ); }, ); } @override Widget build(BuildContext context) { final deviceSize = MediaQuery.of(context).size; final orientation = MediaQuery.of(context).orientation; return GridView.builder( padding: const EdgeInsets.all(15), itemCount: mediaList.length, gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( maxCrossAxisExtent: 200.0, childAspectRatio: 3 / 2, crossAxisSpacing: 20, mainAxisSpacing: 20, ), itemBuilder: (context, index) { return FutureBuilder( future: mediaList[index].thumbData, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.done) { return Stack( children: [ InkWell( splashColor: Theme.of(context).canvasColor, borderRadius: BorderRadius.circular(12), onTap: () { Navigator.of(context).pushNamed( VideoScreen.routeName, arguments: { 'video-title': videoList[index].videoTitle, 'video-file': videoList[index].videoData, }, ); }, child: Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), elevation: 5.0, child: Container( height: deviceSize.height * 0.25, width: deviceSize.width * 0.45, child: ClipRRect( borderRadius: BorderRadius.circular(12), child: GridTile( child: Image.memory(snapshot.data, fit: BoxFit.cover), ), ), ), ), ), Positioned( left: 5, right: 3.9, bottom: orientation == Orientation.landscape ? 10.9 : 5, child: Container( padding: const EdgeInsets.symmetric( vertical: 5, horizontal: 20), margin: const EdgeInsets.only(left: 8, bottom: 8), width: deviceSize.width * 0.37, child: Text( '${videoList[index].videoTitle}', style: TextStyle(color: Colors.white), maxLines: 1, overflow: TextOverflow.ellipsis, softWrap: false, ), decoration: BoxDecoration( // borderRadius: BorderRadius.only( // bottomRight: Radius.circular(15), // bottomLeft: Radius.circular(15), // ), color: Colors.black26, ), ), ), Positioned( top: 5, left: 0, child: Container( padding: const EdgeInsets.symmetric( vertical: 1, horizontal: 8), margin: const EdgeInsets.only(left: 4, top: 8), width: deviceSize.width > 600 ? deviceSize.width * 0.15 : deviceSize.width * 0.3, child: Text( '${videoList[index].videoDuration}', style: TextStyle(color: Colors.white), maxLines: 1, overflow: TextOverflow.ellipsis, softWrap: false, ), decoration: BoxDecoration( color: Colors.black12, ), ), ), Positioned( top: 1, right: 4, child: InkWell( splashColor: Theme.of(context).canvasColor, borderRadius: BorderRadius.circular(4), onTap: () { _openBottomSheet( context, videoList[index], //imageList[index], ); print( 'All_Videos_Grid: ${videoList[index].videoTitle} was clicked'); }, child: Container( padding: const EdgeInsets.all(4.0), margin: const EdgeInsets.only(right: 5, top: 8), child: Icon(Icons.more_vert, color: Colors.white), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(4), ), color: Colors.black12, ), ), ), ), ], ); } else { return Container( child: Center( child: Shimmer.fromColors( child: Container( decoration: BoxDecoration( color: Colors.black26, ), ), baseColor: Theme.of(context).primaryColor, highlightColor: Theme.of(context).canvasColor, ), ), ); } }, ); }, ); } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/widgets/option_list.dart
import 'package:flutter/material.dart'; import '../screens/video_screen.dart'; import '../models/video.dart'; class OptionList extends StatelessWidget { final Video mVideo; OptionList({ @required this.mVideo, }); void _getVideoInfo(BuildContext ctx) async { showModalBottomSheet( shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical( top: Radius.circular(12.0), ), ), context: ctx, builder: (_) { return GestureDetector( child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.all(12.0), child: Text( 'Video name: ${mVideo.videoTitle}', style: Theme.of(ctx).textTheme.headline1, maxLines: 1, overflow: TextOverflow.fade, softWrap: false, ), ), Padding( padding: const EdgeInsets.all(12.0), child: Text( 'Created on: ${mVideo.videoCreationTime}', style: Theme.of(ctx).textTheme.headline1, ), ), Padding( padding: const EdgeInsets.all(12.0), child: Text( 'File location: ${mVideo.videoPath}', style: Theme.of(ctx).textTheme.headline1, ), ), ], ), ), onTap: () {}, behavior: HitTestBehavior.opaque, ); }, ); } @override Widget build(BuildContext context) { return SingleChildScrollView( child: Container( padding: const EdgeInsets.all(12), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ FlatButton( splashColor: Theme.of(context).splashColor, child: Text( 'Play', style: Theme.of(context).textTheme.headline1, ), onPressed: () { Navigator.pop(context); Navigator.of(context).pushNamed( VideoScreen.routeName, arguments: { 'video-title': mVideo.videoTitle, 'video-file': mVideo.videoData, }, ); }, ), FlatButton( splashColor: Theme.of(context).splashColor, child: Text( 'Video information', style: Theme.of(context).textTheme.headline1, ), onPressed: () { Navigator.pop(context); _getVideoInfo(context); }, ), FlatButton( splashColor: Theme.of(context).splashColor, child: Text( 'Add subtitle', style: Theme.of(context).textTheme.headline1, ), onPressed: () { Navigator.pop(context); }, ), FlatButton( splashColor: Theme.of(context).splashColor, child: Text( 'Play as audio', style: Theme.of(context).textTheme.headline1, ), onPressed: () { Navigator.pop(context); }, ), ], ), ), ); } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/models/styles.dart
import 'dart:ui'; import 'package:flutter/material.dart'; ///[Styles] is a class that is used to manage app themeData based on either app's on ///Light Theme or Dark Theme class Styles { static ThemeData themeData(bool isDarkTheme, BuildContext context) { return ThemeData( primarySwatch: Colors.orange, primaryColor: isDarkTheme ? Colors.black : Colors.orange, accentColor: isDarkTheme ? Colors.black : Colors.orange, splashColor: Colors.grey.withOpacity(0.1), canvasColor: isDarkTheme ? Colors.grey[900] : Colors.orange[50], brightness: isDarkTheme ? Brightness.dark : Brightness.light, fontFamily: 'Play', accentColorBrightness: isDarkTheme ? Brightness.light : Brightness.dark, buttonTheme: isDarkTheme ? ButtonTheme.of(context).copyWith( buttonColor: Colors.black, textTheme: ButtonTextTheme.primary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), ) : ButtonTheme.of(context).copyWith( buttonColor: Colors.orange, textTheme: ButtonTextTheme.primary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), ), textTheme: isDarkTheme ? ThemeData.dark().textTheme.copyWith( bodyText2: TextStyle( color: Colors.white, ), bodyText1: TextStyle( color: Colors.white, fontStyle: FontStyle.italic, ), headline1: TextStyle( fontSize: 16, fontFamily: 'Play', fontWeight: FontWeight.normal, color: Colors.white, ), headline6: TextStyle( color: Colors.white, fontSize: 24, fontFamily: 'Play', fontWeight: FontWeight.bold, ), headline5: TextStyle( color: Colors.white, fontSize: 18, fontFamily: 'Play', fontWeight: FontWeight.w600, ), ) : ThemeData.light().textTheme.copyWith( bodyText2: TextStyle( color: Colors.black, fontFamily: 'Play', ), bodyText1: TextStyle( color: Colors.black, fontFamily: 'Play', ), headline1: TextStyle( fontSize: 18, fontFamily: 'Play', fontWeight: FontWeight.normal, color: Colors.black, ), headline6: TextStyle( fontSize: 24, fontFamily: 'Play', fontWeight: FontWeight.bold, ), headline5: TextStyle( fontSize: 18, fontFamily: 'Play', fontWeight: FontWeight.w600, ), ), visualDensity: VisualDensity.adaptivePlatformDensity, ); } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/models/video.dart
import 'dart:io'; import 'package:flutter/foundation.dart'; ///[Video] models how a particular video object should look like and have in it. class Video { ///[videoTitle] name of the video final String videoTitle; ///[videoDuration] video duration in minutes final String videoDuration; ///[videoData] video data final Future<File> videoData; ///[videoCreationTime] create time for video final String videoCreationTime; ///[videoPath] video location on device final String videoPath; ///[videoSubtitleFilePath] subtitle for video final String videoSubtitleFilePath; Video({ @required this.videoTitle, @required this.videoDuration, @required this.videoData, @required this.videoCreationTime, @required this.videoPath, this.videoSubtitleFilePath = '', }); }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/helpers/dark_theme_provider.dart
import 'package:flutter/foundation.dart'; import '../helpers/dark_theme_pref.dart'; ///[DarkThemeProvider] apply user theme choice class DarkThemeProvider with ChangeNotifier { DarkThemePreference darkThemePreference = DarkThemePreference(); bool _darkTheme = false; ///get if dark theme should be applied bool get darkTheme => _darkTheme; ///set the desired theme type by returning ///```true``` for dark theme or ```false``` for light theme set darkTheme(bool value) { _darkTheme = value; darkThemePreference.setDarkTheme(value); notifyListeners(); } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/helpers/dark_theme_pref.dart
import 'package:shared_preferences/shared_preferences.dart'; ///[DarkThemePreference] is used to save user dark theme preference class DarkThemePreference { static const THEME_STATUS = 'THEME_STATUS'; SharedPreferences prefs; ///set user dark theme choice void setDarkTheme(bool value) async { prefs = await SharedPreferences.getInstance(); prefs.setBool(THEME_STATUS, value); } ///get user dark theme choice Future<bool> getTheme() async { prefs = await SharedPreferences.getInstance(); return prefs.getBool(THEME_STATUS) ?? false; } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/screens/video_screen.dart
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; import 'package:flick_video_player/flick_video_player.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; ///[VideoScreen] this will display the video class VideoScreen extends StatefulWidget { static const routeName = '/video-screen'; @override _VideoScreenState createState() => _VideoScreenState(); } class _VideoScreenState extends State<VideoScreen> { Map<String, Object> _receivedData; Future<File> _videoFile; String _videoTitle; VideoPlayerController _controller; bool initialized = false; FlickManager _flickManager; void _initVideo() async { final video = await _videoFile; _controller = VideoPlayerController.file(video) ..setLooping(true) ..initialize() ..addListener(() => setState(() {})) ..play(); _flickManager = FlickManager( videoPlayerController: _controller, ); } @override void didChangeDependencies() { super.didChangeDependencies(); _receivedData = ModalRoute.of(context).settings.arguments as Map<String, Object>; _videoFile = _receivedData['video-file']; _videoTitle = _receivedData['video-title']; print('Video Screen: _videoFile gotten = ${_videoFile != null}'); print('Video Screen: _videoTitle gotten = $_videoTitle'); _initVideo(); } @override Widget build(BuildContext context) { //final deviceSize = MediaQuery.of(context).size; return Scaffold( appBar: AppBar( title: Text(_videoTitle), ), body: _controller.value.initialized ? Container( child: FlickVideoPlayer( flickManager: _flickManager, flickVideoWithControls: FlickVideoWithControls( videoFit: BoxFit.contain, controls: FlickPortraitControls( iconSize: 25, fontSize: 14, progressBarSettings: FlickProgressBarSettings( playedColor: Colors.orange, height: 5, handleRadius: 5.3, ), ), playerLoadingFallback: SpinKitPulse( color: Theme.of(context).primaryColor, ), ), ), ) : SpinKitPulse( color: Theme.of(context).primaryColor, ), ); } @override void dispose() { super.dispose(); if (_flickManager != null) { _controller.removeListener(() => setState(() {})); _flickManager.dispose(); } } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/screens/all_videos_screen.dart
import 'package:flutter/material.dart'; import 'package:photo_manager/photo_manager.dart'; import 'package:provider/provider.dart'; import '../models/video.dart'; import '../widgets/all_videos_grid.dart'; import '../screens/settings_screen.dart'; import '../providers/video_manager.dart'; ///[AllVideosScreen] will display a grid of all videos on the user's device class AllVideosScreen extends StatefulWidget { @override _AllVideosScreenState createState() => _AllVideosScreenState(); } class _AllVideosScreenState extends State<AllVideosScreen> { List<AssetEntity> _allVideos = []; final videoManager = VideoManager(); List<Video> _modelVideos = []; @override void initState() { super.initState(); _getVideoData(); } void _getVideoData() async { final _vManager = Provider.of<VideoManager>(context, listen: false); await _vManager.fetchMedia(); setState(() { _allVideos = _vManager.allVideos; _modelVideos = _vManager.modelVideos; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( elevation: 0, title: Text('Video Player'), actions: [ PopupMenuButton( tooltip: 'more options', icon: Icon(Icons.more_vert), itemBuilder: (_) => [ PopupMenuItem( child: Text('Settings'), value: MoreOptions.Settings, ), ], onSelected: (MoreOptions selectedValue) { if (selectedValue == MoreOptions.Settings) { Navigator.of(context).pushNamed(SettingsScreen.routeName); } }, ), ], ), body: AllVideosGrid( mediaList: _allVideos, videoList: _modelVideos, ), ); } } enum MoreOptions { Settings }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/screens/settings_screen.dart
import 'package:flutter/material.dart'; import 'package:settings_ui/settings_ui.dart'; import 'package:provider/provider.dart'; import '../helpers/dark_theme_provider.dart'; ///[SettingsScreen] screen is used to display user prefences options class SettingsScreen extends StatelessWidget { static const routeName = '/settings'; @override Widget build(BuildContext context) { final themeChange = Provider.of<DarkThemeProvider>(context); return Scaffold( appBar: AppBar( elevation: 0, title: Text('Settings'), ), body: Container( padding: const EdgeInsets.only(top: 1.0), child: SettingsList( backgroundColor: !themeChange.darkTheme ? Theme.of(context).canvasColor : null, sections: [ SettingsSection( title: 'Preferences', titleTextStyle: TextStyle(color: themeChange.darkTheme ? Colors.white: Colors.black), tiles: [ SettingsTile.switchTile( title: 'Dark Mode', leading: Icon(themeChange.darkTheme ? Icons.bedtime : Icons.bedtime_outlined, color: Colors.orange,), switchValue: themeChange.darkTheme, switchActiveColor : Colors.orange, onToggle: (bool val) { themeChange.darkTheme = val; print('Settings: Dark Mode = $val'); }, ), ], ), ], ), ), ); } }
0
mirrored_repositories/vid_player/lib
mirrored_repositories/vid_player/lib/providers/video_manager.dart
import 'package:flutter/foundation.dart'; import 'package:photo_manager/photo_manager.dart'; import '../models/video.dart'; ///[Video Manager] manages all the video operations class VideoManager with ChangeNotifier { List<AssetEntity> _allVideos = []; List<Video> _modelVideos = []; List<Video> _mVideos = []; ///return all videos as in raw form List<AssetEntity> get allVideos { return [..._allVideos]; } ///return all vidoes in [Video] form List<Video> get modelVideos { return [..._modelVideos]; } ///[fetchMedia] used to get video data from local device Future<void> fetchMedia() async { var result = await PhotoManager.requestPermission(); if (result) { //load all file paths to videos List<AssetPathEntity> videos = await PhotoManager.getAssetPathList( onlyAll: true, type: RequestType.video); print('VideoManager: All videos path gotten = $videos'); print('VideoManager: Value = ${videos[0].assetCount}'); //get all the videos //using videos[0] because it contains all the videos while other indexes contain grouped videos List<AssetEntity> allVideos = await videos[0].getAssetListPaged(0, videos[0].assetCount); print('VideoManager: All videos extracted = $allVideos'); //package the data gotten for (var video in allVideos) { _mVideos.add(Video( videoTitle: video.title, videoDuration: _getTime(video.duration), videoData: video.file, videoCreationTime: _getFormattedDate(video.createDateTime.toString()), videoPath: _getFormattedPath(video.relativePath), )); print('VideoManager: video title = ${video.title}'); print('VideoManager: video duration = ${video.duration.toString()}'); print('VideoManager: video file gotten = ${video.file != null}'); print('Video Manager: video creation time = ${video.createDateTime}'); print('Video Manager: video path = ${video.relativePath}'); } _allVideos = allVideos; _modelVideos = _mVideos; } else { //result failed PhotoManager.openSetting(); } notifyListeners(); } //get formmatted time String _getFormattedDate(String dateTime) { var time = dateTime.split('.')[0]; var formattedTime = time.replaceAll(' ', 'at '); print('Created on: $formattedTime'); return formattedTime; } //get formatted path String _getFormattedPath(String val) { var storedPath = val; if (val.contains('/storage/emulated/0/')) { storedPath = storedPath.replaceAll('/storage/emulated/0/', 'Internal Storage > '); } else { var breaker = val.split('/'); var location = breaker[breaker.length - 1]; storedPath = 'SD Card > $location'; } print('VideoManager: Video location = $storedPath'); return storedPath; } //get a formatted string of the time for each video String _getTime(int inputTime) { var timeInSecs = 0; var timeInMins = 0; var timeInHrs = 0; var hrStr = ''; var minsStr = ''; var secsStr = ''; var formattedStr = ''; if (inputTime < 60) { timeInSecs = inputTime % 60; secsStr = '${timeInSecs}s'; } else if (inputTime > 60 && inputTime < 3600) { timeInMins = inputTime ~/ 60; minsStr = '${timeInMins}m'; timeInSecs = inputTime % 60; secsStr = '${timeInSecs}s'; } else { timeInHrs = (inputTime ~/ 3600); hrStr = '${timeInHrs}h'; var remainder = inputTime % 3600; timeInMins = remainder ~/ 60; minsStr = '${timeInMins}m'; timeInSecs = remainder % 60; secsStr = '${timeInSecs}s'; } formattedStr = ('$hrStr $minsStr $secsStr').trim(); print('VideoManager: Formatted video time = $formattedStr'); return formattedStr; } }
0
mirrored_repositories/vid_player
mirrored_repositories/vid_player/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:vid_player/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(VidPlayerApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-UI-Challenges-banking_application_screen
mirrored_repositories/Flutter-UI-Challenges-banking_application_screen/lib/main.dart
import 'package:flutter/material.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: MyHomePage(title: 'Banking App Screen'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class EmptyAppBar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { return Container(); } @override Size get preferredSize => Size(0.0, 0.0); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( primary: false, appBar: EmptyAppBar(), body: ListView( children: <Widget>[ Stack( children: <Widget>[ Container( height: 200.0, width: double.infinity, color: Colors.orange, ), Positioned( bottom: 150, left: -40, child: Container( height: 140, width: 140, decoration: BoxDecoration( borderRadius: BorderRadius.circular(70), color: Colors.yellowAccent[100].withOpacity(0.1)), )), Positioned( top: -120, left: 100, child: Container( height: 300, width: 300, decoration: BoxDecoration( borderRadius: BorderRadius.circular(150), color: Colors.yellowAccent[100].withOpacity(0.1)), )), Positioned( top: -50, left: 0, child: Container( height: 200, width: 200, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: Colors.yellowAccent[100].withOpacity(0.1)), )), Positioned( top: 0, right: 0, child: Container( height: 150, width: 150, decoration: BoxDecoration( borderRadius: BorderRadius.circular(75), color: Colors.yellowAccent[100].withOpacity(0.1)), )), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ SizedBox( height: 70.0, ), Padding( padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Text( "Savings Ac.", style: TextStyle( fontSize: 30, color: Colors.white, fontWeight: FontWeight.w500), ), Expanded( flex: 1, child: Container(), ), RaisedButton( child: Text( "Active", style: TextStyle( color: Colors.orange, fontWeight: FontWeight.w500, fontSize: 16), ), onPressed: () {}, elevation: 1.0, color: Colors.white, ), ], ), ), Padding( padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), child: Text( "****4546", style: TextStyle( fontSize: 20, color: Colors.white.withOpacity(0.70), fontWeight: FontWeight.w500), ), ), SizedBox( height: 25, ), Padding( padding: const EdgeInsets.fromLTRB(20, 0, 20, 10), child: Container( height: 100, width: MediaQuery.of(context).size.width, child: Material( elevation: 2.0, color: Colors.white, borderRadius: BorderRadius.circular(5.0), child: Padding( padding: const EdgeInsets.only(left: 25), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Available Balance', style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, color: Colors.black54), ), Row( children: <Widget>[ Text( '7567.86', style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, color: Colors.black), ), Text( 'INR', style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: Colors.black54), ) ], ), ], ), ), ), ), ) ], ), ], ), getGridView() ], ), ); } Widget getGridView() { return GridView.count( shrinkWrap: true, crossAxisCount: 2, primary: false, childAspectRatio: (MediaQuery .of(context) .size .width - 60 / 2) / 280, children: <Widget>[ createTile(0,_selectedIndex,false, 'Profile', Colors.purple, Icons.person), createTile(1,_selectedIndex,true, 'Activity', Colors.yellow, Icons.local_activity), createTile(2,_selectedIndex,false, 'Statement', Colors.brown, Icons.print), createTile(3,_selectedIndex,true, 'Transfer', Colors.red, Icons.local_atm), createTile(4,_selectedIndex,false, 'Overview', Colors.green, Icons.remove_red_eye), createTile(5,_selectedIndex,true, 'Settings', Colors.blue, Icons.settings), ], ); } int _selectedIndex = -1; Widget createTile(int index,int selectedIndex,bool isEven, String title, Color color, IconData icon) { return Padding( padding: EdgeInsets.only( left: isEven?10:20, right: isEven?20:10, top: 10, bottom: 10), child: Container( width: MediaQuery.of(context).size.width, child: GestureDetector( onTap: (){ setState(() { _selectedIndex = index; }); }, child: Material( elevation: 3.0, color: _selectedIndex==index?Colors.orange:Colors.white, borderRadius: BorderRadius.circular(5.0), child: Padding( padding: const EdgeInsets.only(left: 20,top: 20,bottom: 20), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Icon(icon,color: _selectedIndex==index?Colors.white:color,), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( title, style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: _selectedIndex==index?Colors.white:Colors.black), ), Padding( padding: const EdgeInsets.only(left:2.0), child: Container( height: 3.0, width: 40, decoration: BoxDecoration( borderRadius: BorderRadius.circular(2.0), color: _selectedIndex==index?Colors.orange:color, ), ), ) ], ), ], ), ), ), ), ), ); } }
0
mirrored_repositories/Flutter-UI-Challenges-banking_application_screen
mirrored_repositories/Flutter-UI-Challenges-banking_application_screen/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:banking_application_screen/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/FootballClub
mirrored_repositories/FootballClub/lib/footballclub_main.dart
import 'package:flutter/material.dart'; import 'package:football_club/football_data.dart'; import 'footballclub.dart'; class FootballClubMain extends StatelessWidget { const FootballClubMain(); @override Widget build(BuildContext context) { final footballClubs = <FootballClub>[]; for (var i = 0; i < footballClubData.length; i++) { footballClubs.add(FootballClub( assetLocation: footballClubData[i].assetLocation, clubName: footballClubData[i].clubName, clubDescription: footballClubData[i].clubDescription, )); } Widget getList(Orientation orientation) { if (orientation == Orientation.portrait) { return new ListView.builder( itemBuilder: (context, index) => footballClubs[index], itemCount: footballClubs.length, ); } else { return new GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), itemBuilder: (context, index) => footballClubs[index], itemCount: footballClubs.length, ); } } return new Scaffold( appBar: AppBar( title: Text('Football Club'), ), body: OrientationBuilder( builder: (context, orientation) => new Container( child: getList(orientation), ), ), ); } }
0
mirrored_repositories/FootballClub
mirrored_repositories/FootballClub/lib/footballclub_detail.dart
import 'package:flutter/material.dart'; class FootballClubDetail extends StatelessWidget { final String assetLocation; final String clubName; final String clubDescription; const FootballClubDetail( {Key key, this.assetLocation, this.clubName, this.clubDescription}) : super(key: key); @override Widget build(BuildContext context) { return new MaterialApp( title: 'Football Club Detail', home: new Scaffold( appBar: AppBar( title: Text(clubName), leading: IconButton( icon: Icon(Icons.arrow_back), onPressed: () { Navigator.of(context).pop(); }, ), ), body: new Container( padding: EdgeInsets.all(16.0), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ new Center( child: Image.asset( assetLocation, height: 100.0, width: 100.0, ), ), new Center( child: Padding( padding: EdgeInsets.all(8.0), child: Text( clubName, style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), ), )), new Padding( padding: EdgeInsets.all(8.0), child: Text(clubDescription), ) ], ), ), ), ); } }
0
mirrored_repositories/FootballClub
mirrored_repositories/FootballClub/lib/football_data.dart
class FootballData { final String clubName; final String clubDescription; final String assetLocation; const FootballData(this.clubName, this.clubDescription, this.assetLocation); } const footballClubData = <FootballData>[ FootballData( 'AC Milan', "A.C. Milan or simply Milan, is a professional football club in Milan, Italy, founded in 1899. The club has spent its entire history, with the exception of the 1980–81 and 1982–83 seasons, in the top flight of Italian football, known as Serie A since 1929–30.", 'assets/img_acm.png'), FootballData( 'Arsenal', "Arsenal Football Club is a professional football club based in Islington, London, England, that plays in the Premier League, the top flight of English football. The club has won 13 League titles, a record 13 FA Cups, two League Cups, the League Centenary Trophy, 15 FA Community Shields, one UEFA Cup Winners' Cup and one Inter-Cities Fairs Cup. It is also the only English club to go a 38-match league season unbeaten, receiving the nickname The Invincibles, and a special gold Premier League trophy.", 'assets/img_arsenal.png'), FootballData( 'Barcelona', "F.C. Barcelona is a Spanish football club from Barcelona, Catalonia. They are known for winning the treble (La Liga, the Copa Del Rey, and the UEFA Champions League) all in 1 season, twice, in the 2008 09 season and in the 2014 15 season. Their biggest rival is Real Madrid. Matches between F.C. Barcelona and Real Madrid are called \"El Clásico\", which means \"The Classic\" in Spanish. The team has won many tournaments, which is why Barcelona is considered one of the best teams in the world. F.C. Barcelona was founded by a group of football players led by Joan Gamper. Their home stadium, Camp Nou is the largest stadium in Europe with a capacity of 99,354", 'assets/img_barca.png'), FootballData( 'Bayern Munchen', "FCB, Bayern Munich, or FC Bayern, is a German sports club based in Munich, Bavaria (Bayern). It is best known for its professional football team, which plays in the Bundesliga, the top tier of the German football league system, and is the most successful club in German football history, having won a record 28 national titles and 18 national cups.", 'assets/img_bayern.png'), FootballData( 'Chelsea', "Chelsea Football Club is a professional football club in London, England, that competes in the Premier League. Founded in 1905, the club's home ground since then has been Stamford Bridge. Chelsea won the First Division title in 1955, followed by various cup competitions between 1965 and 1971. The past two decades have seen sustained success, with the club winning 21 trophies since 1997. In total, the club has won 27 major trophies; six titles, seven FA Cups, five League Cups and four FA Community Shields, one UEFA Champions League, two UEFA Cup Winners' Cups, one UEFA Europa League and one UEFA Super Cup.", 'assets/img_chelsea.png'), FootballData( 'Manchester City', "Manchester City Football Club are a football club in Manchester, England. Founded in 1880 as St. Mark's (West Gorton), they became Ardwick Association Football Club in 1887 and Manchester City in 1894. The club's home ground is the City of Manchester Stadium in east Manchester, which they moved to in 2003, having played at Maine Road since 1923.", 'assets/img_city.png'), FootballData( 'Real Madrid', "Founded on 6 March 1902 as Madrid Football Club, the club has traditionally worn a white home kit since inception. The word Real is Spanish for Royal and was bestowed to the club by King Alfonso XIII in 1920 together with the royal crown in the emblem. The team has played its home matches in the 81,044 capacity Santiago Bernabéu Stadium in downtown Madrid since 1947. Unlike most European sporting entities, Real Madrid\'s members (socios) have owned and operated the club throughout its history.", 'assets/img_madrid.png'), FootballData( 'Manchester United', "Manchester United Football Club is a professional football club based in Old Trafford, Greater Manchester, England, that competes in the Premier League, the top flight of English football. Nicknamed \"the Red Devils\", the club was founded as Newton Heath LYR Football Club in 1878, changed its name to Manchester United in 1902 and moved to its current stadium, Old Trafford, in 1910.", 'assets/img_mu.png'), ];
0
mirrored_repositories/FootballClub
mirrored_repositories/FootballClub/lib/main.dart
import 'package:flutter/material.dart'; import 'footballclub_main.dart'; void main() => runApp(FootballClub()); class FootballClub extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Football Club', home: new FootballClubMain(), ); } }
0
mirrored_repositories/FootballClub
mirrored_repositories/FootballClub/lib/footballclub.dart
import 'package:flutter/material.dart'; import 'footballclub_detail.dart'; class FootballClub extends StatelessWidget { final String assetLocation; final String clubName; final String clubDescription; const FootballClub( {Key key, this.assetLocation, this.clubName, this.clubDescription}) : super(key: key); @override Widget build(BuildContext context) { return Material( color: Colors.transparent, child: Container( height: 100.0, child: InkWell( splashColor: Colors.grey, onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => new FootballClubDetail( assetLocation: assetLocation, clubName: clubName, clubDescription: clubDescription, ))); }, child: Padding( padding: EdgeInsets.all(8.0), child: Row( children: <Widget>[ Padding( padding: EdgeInsets.all(8.0), child: Image.asset( assetLocation, height: 50.0, width: 50.0, ), ), Center( child: new Padding( padding: const EdgeInsets.all(8.0), child: Text( clubName, textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline, ), ), ) ], ), ), ), ), ); } }
0
mirrored_repositories/calcimc
mirrored_repositories/calcimc/lib/calcImc.dart
import 'package:flutter/material.dart'; class CalculadoraImc extends StatefulWidget { @override _CalculadoraImcState createState() => _CalculadoraImcState(); } class _CalculadoraImcState extends State<CalculadoraImc> { String _str = 'Informe seus dados!'; TextEditingController peso = TextEditingController(); TextEditingController altura = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Calculadora de IMC"), actions: <Widget>[ IconButton( icon: Icon(Icons.refresh), onPressed: () { setState(() { _str = 'Informe seus dados!'; altura.clear(); peso.clear(); }); }, ), ], ), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(15.0), child: Column( // crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Icon( Icons.person_outline, size: 120.0, color: Colors.blue, ), Padding( padding: const EdgeInsets.all(20.0), child: TextFormField( controller: altura, keyboardType: TextInputType.number, decoration: InputDecoration( labelText: 'Altura (cm)', labelStyle: TextStyle( color: Colors.blue, fontSize: 20, ), ), textAlign: TextAlign.center, style: TextStyle( fontSize: 25, ), ), ), Padding( padding: const EdgeInsets.all(20.0), child: TextFormField( controller: peso, keyboardType: TextInputType.number, decoration: InputDecoration( labelText: 'Peso (kg)', labelStyle: TextStyle( color: Colors.blue, fontSize: 20, ), ), textAlign: TextAlign.center, style: TextStyle( fontSize: 25, ), ), ), Padding( padding: const EdgeInsets.all(20.0), child: Container( decoration: BoxDecoration( boxShadow: [ BoxShadow( blurRadius: 5.0, color: Colors.black26, offset: Offset(0, 2), spreadRadius: 1.0, ), ], ), width: double.maxFinite, child: FlatButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(10), topRight: Radius.circular(10)), ), color: Colors.blue, padding: EdgeInsets.all(20.0), onPressed: () { double weight = double.parse(peso.text); double height = double.parse(altura.text) / 100; double imc = weight / (height * height); setState(() { _str = 'Seu imc é: ${imc.toStringAsPrecision(4)}'; }); }, child: Text( "Calcular", style: TextStyle( color: Colors.white, fontSize: 20, ), ), ), ), ), Text( _str, style: TextStyle( fontSize: 20, ), ), ], ), ), ), ); } }
0
mirrored_repositories/calcimc
mirrored_repositories/calcimc/lib/main.dart
import 'package:calcimc/calcImc.dart'; import 'package:flutter/material.dart'; void main() { runApp(Inicial()); } class Inicial extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: CalculadoraImc(), ); } }
0
mirrored_repositories/fypapp
mirrored_repositories/fypapp/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:fypapp/screens/home/home_screen.dart'; import 'package:fypapp/screens/localization/demo_localizaton.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/apple/apple_blackrot.dart'; import 'package:fypapp/screens/plants/apple/apple_scab.dart'; import 'package:fypapp/screens/plants/apple/cedar_applerust.dart'; import 'package:fypapp/screens/plants/cherry/cherry_mildew.dart'; import 'package:fypapp/screens/plants/grape/grape_blackmeasles.dart'; import 'package:fypapp/screens/plants/grape/grape_blackrot.dart'; import 'package:fypapp/screens/plants/grape/grape_leafblight.dart'; import 'package:fypapp/screens/plants/maize/maize_leafblight.dart'; import 'package:fypapp/screens/plants/maize/maize_rust.dart'; import 'package:fypapp/screens/plants/peach/peach_bacterial.dart'; import 'package:fypapp/screens/plants/pepper/pepper_bacterial.dart'; import 'package:fypapp/screens/plants/potato/potato_earlyb.dart'; import 'package:fypapp/screens/plants/potato/potato_lateb.dart'; import 'package:fypapp/screens/plants/sberry/sberry_scorch.dart'; import 'package:fypapp/screens/plants/squash/squash_mildew.dart'; import 'package:fypapp/screens/plants/tomato/tomato_bacterial.dart'; import 'package:fypapp/screens/plants/tomato/tomato_earlyb.dart'; import 'package:fypapp/screens/plants/tomato/tomato_lateb.dart'; import 'package:fypapp/screens/plants/tomato/tomato_leafspot.dart'; import 'package:fypapp/screens/plants/tomato/tomato_mosaicv.dart'; import 'package:fypapp/screens/plants/tomato/tomato_spiderm.dart'; import 'package:fypapp/screens/plants/tomato/tomato_tspot.dart'; import 'package:fypapp/screens/plants/tomato/tomato_yellow.dart'; import 'package:fypapp/splashscreen/onboard.dart'; import 'package:fypapp/splashscreen/splashscreen.dart'; void main() => runApp(MyApp()); var routes = <String, WidgetBuilder>{ "/": (BuildContext context) => SplashScreen(), "/home": (BuildContext context) => HomeScreen(), "/ABRdisease": (BuildContext context) => ABRdisease(), "/ASdisease": (BuildContext context) => ASdisease(), "/ARdisease": (BuildContext context) => ARdisease(), "/CPMdisease": (BuildContext context) => CPMdisease(), "/GEBMdisease": (BuildContext context) => GEBMdisease(), "/GBRdisease": (BuildContext context) => GBRdisease(), "/GLBdisease": (BuildContext context) => GLBdisease(), "/MLBdisease": (BuildContext context) => MLBdisease(), "/MLSdisease": (BuildContext context) => MLBdisease(), "/MCRdisease": (BuildContext context) => MCRdisease(), "/PBSdisease": (BuildContext context) => PBSdisease(), "/PPBSdisease": (BuildContext context) => PPBSdisease(), "/POEBdisease": (BuildContext context) => POEBdisease(), "/POLBdisease": (BuildContext context) => POLBdisease(), "/SBERRYLSdisease": (BuildContext context) => SBERRYLSdisease(), "/SQUPMdisease": (BuildContext context) => SQUPMdisease(), "/TOMBSdisease": (BuildContext context) => TOMBSdisease(), "/TOMEBdisease": (BuildContext context) => TOMEBdisease(), "/TOMLBdisease": (BuildContext context) => TOMLBdisease(), "/TOMLMdisease": (BuildContext context) => TOMLBdisease(), "/TSLSdisease": (BuildContext context) => TSLSdisease(), "/TTMVdisease": (BuildContext context) => TTMVdisease(), "/TSMTdisease": (BuildContext context) => TSMTdisease(), "/TTSdisease": (BuildContext context) => TTSdisease(), "/TTYdisease": (BuildContext context) => TTYdisease(), "/onboard": (BuildContext context) => Onboard(), }; class MyApp extends StatefulWidget { // This widget is the root of your application. static void setLocale(BuildContext context, Locale locale) { _MyAppState state = context.findRootAncestorStateOfType<_MyAppState>(); state.setLocale(locale); } @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { Locale _locale; void setLocale(Locale locale) { setState(() { _locale = locale; }); } @override void didChangeDependencies() { // TODO: implement didChangeDependencies getLocale().then((locale) { // get locale setState(() { this._locale = locale; }); }); super.didChangeDependencies(); } @override Widget build(BuildContext context) { if (_locale == null) { return Container( child: Center( child: CircularProgressIndicator(), ), ); } else { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( // This is the theme of your application. // // Try running your application with "flutter run". You'll see the // application has a blue toolbar. Then, without quitting the app, try // changing the primarySwatch below to Colors.green and then invoke // "hot reload" (press "r" in the console where you ran "flutter run", // or simply save your changes to "hot reload" in a Flutter IDE). // Notice that the counter didn't reset back to zero; the application // is not restarted. primarySwatch: Colors.blue, fontFamily: 'Montserrat'), //home: SplashScreen(), //onUnknownRoute: (settings) => , routes: routes, //debugShowCheckedModeBanner: false, locale: _locale, supportedLocales: [ Locale('en', 'GB'), Locale('ms', 'MY'), Locale('zh', 'CN') ], localizationsDelegates: [ DemoLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], localeResolutionCallback: (devicelocale, supportedLocales) { for (var locale in supportedLocales) { if (locale.languageCode == devicelocale.languageCode && locale.countryCode == devicelocale.countryCode) { return devicelocale; } } return supportedLocales.first; }, ); } } } //{} //
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/splashscreen/splashscreen.dart
import 'dart:async'; import 'package:flutter/material.dart'; class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> { @override void initState() { // TODO: implement initState super.initState(); Timer(Duration(seconds: 2), () => MyNavigator.goToOnboard(context)); } @override // TODO: implement widget Widget build(BuildContext context) { return Scaffold( body: Stack( fit: StackFit.expand, children: <Widget>[ Container( decoration: BoxDecoration(color: Colors.green), ), Column( mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ Expanded( flex: 2, child: Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ CircleAvatar( backgroundColor: Colors.white, radius: 50.0, child: Icon( Icons.shopping_cart, color: Colors.greenAccent, size: 50.0, ), ), Padding(padding: EdgeInsets.only(top: 10.0)), Text( "AGRIKai", style: TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold), ), ], ), )), Expanded( flex: 1, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ CircularProgressIndicator(), Padding(padding: EdgeInsets.only(top: 20.0)), Text( "Detect First, Eat Healthy", style: TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold), ) ], )) ], ) ], ), ); } } class MyNavigator { static void goToOnboard(BuildContext context) { //Navigator.pushNamed(context, "/onboard"); Navigator.pushReplacementNamed(context, "/onboard"); } // static void goToHome(BuildContext context) { // //Navigator.pushNamed(context, "/home"); // Navigator.pushReplacementNamed(context, "/home"); // } }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/splashscreen/onboard.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/utilities/styles.dart'; class Onboard extends StatefulWidget { @override _OnboardState createState() => _OnboardState(); } class _OnboardState extends State<Onboard> { final int numOfPages = 3; final PageController pageController = PageController( initialPage: 0, ); int currentPage = 0; List<Widget> buildPageIndicator() { List<Widget> list = []; for (int i = 0; i < numOfPages; i++) { list.add(i == currentPage ? indicator(true) : indicator(false)); } return list; } Widget indicator(bool isActive) { return AnimatedContainer( duration: Duration(milliseconds: 150), margin: EdgeInsets.symmetric(horizontal: 8.0), height: 8.0, width: isActive ? 24.0 : 16.0, decoration: BoxDecoration( color: isActive ? Colors.white : Color(0xFF7B51D3), borderRadius: BorderRadius.all(Radius.circular(12)), ), ); } @override Widget build(BuildContext context) { var hei = MediaQuery.of(context).size.height; var wid = MediaQuery.of(context).size.width; return Scaffold( body: AnnotatedRegion<SystemUiOverlayStyle>( value: SystemUiOverlayStyle.light, child: Container( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, stops: [0.1, 0.4, 0.7, 0.9], colors: [ Color(0xFF3594DD), Color(0xFF4563DB), Color(0xFF5036D5), Color(0xFF5B16D0), ], ), ), child: Padding( padding: EdgeInsets.symmetric(vertical: 30.0), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Container( alignment: Alignment.centerRight, child: FlatButton( onPressed: () { // Navigator.push( // context, // MaterialPageRoute( // builder: (context) => HomeScreen())); Navigator.pushReplacementNamed(context, "/home"); }, //go to plant home page child: Text( "${getTranslated(context, 'skip')}", style: TextStyle( color: Colors.white, fontSize: 20.0, fontFamily: 'Montserrat'), ), ), ), Container( height: hei * 0.75, child: PageView( physics: ClampingScrollPhysics(), controller: pageController, onPageChanged: (int page) { setState(() { currentPage = page; }); }, children: <Widget>[ Padding( padding: EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Center( child: Image( image: AssetImage("lib/images/on1.PNG"), height: hei * 0.50, width: wid * 1, ), ), SizedBox( height: hei * 0.03, ), Text( "${getTranslated(context, 'snap_a_picture')}", style: TextStyles.OnboardTitleText, ), SizedBox( height: 15.0, ), Text( "${getTranslated(context, 'desc1')}", style: TextStyles.OnBoardSubText, ), ], ), ), Padding( padding: EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Center( child: Image( image: AssetImage("lib/images/on2.png"), height: hei * 0.50, width: wid * 1, ), ), SizedBox( height: hei * 0.03, ), Text( "${getTranslated(context, 'see_result')}", style: TextStyles.OnboardTitleText, ), SizedBox(height: 20.0), Text( "${getTranslated(context, 'desc2')}", style: TextStyles.OnBoardSubText, ) ], ), ), Padding( padding: EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Center( child: Image( image: AssetImage("lib/images/on3.PNG"), height: hei * 0.5, width: wid * 1, ), ), SizedBox( height: hei * 0.03, ), Text( "${getTranslated(context, 'check_more')}", style: TextStyles.OnboardTitleText, ), SizedBox(height: 15.0), Text( "${getTranslated(context, 'desc3')}", style: TextStyles.OnBoardSubText, ) ], ), ) ], ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: buildPageIndicator(), ), currentPage != numOfPages - 1 ? Expanded( child: Align( alignment: FractionalOffset.bottomRight, child: FlatButton( onPressed: () { pageController.nextPage( duration: Duration(milliseconds: 500), curve: Curves.ease); }, child: Row( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: <Widget>[ Text( "${getTranslated(context, 'next')}", style: TextStyle( color: Colors.white, fontSize: 22.0), ), SizedBox(width: 10.0), Icon( Icons.arrow_forward, color: Colors.white, size: 30.0, ) ], ), ), ), ) : Text(""), ]), ), ), ), bottomSheet: currentPage == numOfPages - 1 ? Container( height: hei * 0.1, width: double.infinity, color: Colors.white, child: GestureDetector( onTap: () { // Navigator.push(context, // MaterialPageRoute(builder: (context) => HomeScreen())); Navigator.pushReplacementNamed(context, "/home"); }, child: Center( child: Padding( padding: EdgeInsets.only(bottom: 10.0), child: Text( "${getTranslated(context, 'start_diagnosis')}", style: TextStyle( color: Color(0xFF5B16D0), fontSize: 20.0, fontWeight: FontWeight.bold, ), ), ), ), ), ) : Text("")); } }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/utilities/rectangle_list.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; List<Map> rectangleList = [ { 'title': 'abr', 'name': 'Apple Black rot', 'image': 'lib/images/apple/abr1.JPG', //'onTap': () => MaterialPageRoute(builder: (context) => ABRdisease()) //'onTap': () => goToPlant(context, "/ABRdisease") 'onTap': "/ABRdisease" }, { 'title': 'as', 'name': 'Apple Scab', 'image': 'lib/images/apple/as1.JPG', 'onTap': "/ASdisease" }, { 'title': 'ar', 'name': 'Cedar Apple Rust', 'image': 'lib/images/apple/ar1.JPG', 'onTap': "/ARdisease" }, { 'title': 'cpm', 'name': 'Cherry Powdery', 'image': 'lib/images/cherry/cpm1.JPG', 'onTap': "/CPMdisease" }, { 'title': 'g_ebm', 'name': 'Grape Esca (Black measles)', 'image': 'lib/images/grape/gebm1.JPG', 'onTap': "/GEBMdisease" }, { 'title': 'g_br', 'name': 'Grape Black rot', 'image': 'lib/images/grape/gbr1.JPG', 'onTap': "/GBRdisease" }, { 'title': 'g_Lb', 'name': 'Grape Leaf blight', 'image': 'lib/images/grape/gLb1.JPG', 'onTap': "/GLBdisease" }, { 'title': 'mLb', 'name': 'Maize Northern leaf blight', 'image': 'lib/images/maize/mLb1.JPG', 'onTap': "/MLBdisease" }, { 'title': 'mLs', 'name': 'Maize Gray Leaf Spot', 'image': 'lib/images/maize/mLs1.JPG', 'onTap': "/MLSdisease" }, { 'title': 'mcr', 'name': 'Maize Common Rust', 'image': 'lib/images/maize/mcr1.JPG', 'onTap': "/MCRdisease" }, { 'title': 'pbs', 'name': 'Peach bacterial spot', 'image': 'lib/images/peach/pbs1.JPG', 'onTap': "/PBSdisease" }, { 'title': 'pp_bs', 'name': 'Pepper bacterial spot', 'image': 'lib/images/pepper/ppbs1.JPG', 'onTap': "/PPBSdisease" }, { 'title': 'po_eb', 'name': 'Potato Early blight', 'image': 'lib/images/potato/poeb1.JPG', 'onTap': "/POEBdisease" }, { 'title': 'po_Lb', 'name': 'Potato Late blight', 'image': 'lib/images/potato/poLb1.JPG', 'onTap': "/POLBdisease" }, { 'title': 'sberry_Ls', 'name': 'Strawberry Leaf scorch', 'image': 'lib/images/sberry/sberryLs1.JPG', 'onTap': "/SBERRYLSdisease" }, { 'title': 'squ_pm', 'name': 'Squash Powdery Mildew', 'image': 'lib/images/apple/abr1.JPG', 'onTap': "/SQUPMdisease" }, { 'title': 'tom_bs', 'name': 'Tomato Bacterial spot', 'image': 'lib/images/tomato/tombs1.JPG', 'onTap': "/TOMBSdisease" }, { 'title': 'tom_eb', 'name': 'Tomato Early blight', 'image': 'lib/images/tomato/tomeb1.JPG', 'onTap': "/TOMEBdisease" }, { 'title': 'tom_Lb', 'name': 'Tomato Late blight', 'image': 'lib/images/tomato/tomLb1.JPG', 'onTap': "/TOMLBdisease" }, { 'title': 'tom_Lm', 'name': 'Tomato Leaf Mold', 'image': 'lib/images/tomato/tomLm1.JPG', 'onTap': "/TOMLMdisease" }, { 'title': 't_sLs', 'name': 'Tomato Septoria Leaf Spot', 'image': 'lib/images/tomato/tsLs1.JPG', 'onTap': "/TSLSdisease" }, { 'title': 't_tmv', 'name': 'Tomato Mosaic Virus', 'image': 'lib/images/tomato/ttmv1.JPG', 'onTap': "/TTMVdisease" }, { 'title': 't_smt', 'name': 'Tomato Spider Mite', 'image': 'lib/images/tomato/tsmt1.JPG', 'onTap': "/TSMTdisease" }, { 'title': 't_ts', 'name': 'Tomato Target Spot', 'image': 'lib/images/tomato/tts1.JPG', 'onTap': "/TTSdisease" }, { 'title': 't_ty', 'name': 'Tomato Yellow Leaf Curl Virus', 'image': 'lib/images/tomato/tty1.JPG', 'onTap': "/TTYdisease" }, ]; class PlantNavigator { static gotoPlant(BuildContext context, String route) { SchedulerBinding.instance.addPostFrameCallback((timeStamp) { //timeStamp = Duration(seconds: 10); Timer(Duration(seconds: 1), () => Navigator.popAndPushNamed(context, route)); //Navigator.popAndPushNamed(context, route); //Navigator.pushReplacementNamed(context, route); }); //Navigator.pushNamed(context, route); // Route route = MaterialPageRoute(builder: (context) => ABRdisease()); // Navigator.push(context, route); } }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/utilities/styles.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/rectangle.dart'; import 'package:fypapp/utilities/rectangle_list.dart'; class TextStyles { static const AppBarText = TextStyle(fontWeight: FontWeight.bold, fontSize: 20); static const OnboardTitleText = TextStyle( fontWeight: FontWeight.bold, color: Colors.white, fontSize: 26.0); static const OnBoardSubText = TextStyle( fontWeight: FontWeight.normal, color: Colors.white, fontSize: 18.0); static const DiseaseTitle = TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 24.0); static const DiseaseName = TextStyle( fontWeight: FontWeight.normal, color: Colors.black, fontSize: 16.0); } class DataSearch extends SearchDelegate<String> { final diseaseTitle = [ "abr (Apple Black rot)", "as (Apple Scab)", "ar (Cedar Apple Rust)", "cpm (Cherry Powdery Mildew)", "g_ebm (Grape Esa)", "g_br (Grape Black rot)", "g_Lb (Grape Leaf blight)", "mLb (Northern blight)", "mLs (Gray Leaf Spot)", "mcr (Maize Common Rust)", "pbs (Peach bacterial spot)", "pp_bs (Pepper bacterial spot)", "po_eb (Potato Early blight)", "po_Lb (Potato Late blight)", "sberry_Ls (Strawberry)", "squ_pm (Squash Powdery)", "tom_bs (Tomato Bacterial spot)", "tom_eb (Tomato Early blight)", "tom_Lb (Tomato Late blight)", "tom_Lm (Tomato Leaf Mold)", "t_sLs (Tomato Leaf Spot)", "t_tmv (Tomato Mosaic virus)", "t_smt (Tomato Spider mite)", "t_ts (Tomato Target spot)", "t_ty (Yellow Leaf Virus)" ]; final disease = [ "abr (Apple Black rot)", "g_br (Grape Black rot)", "tom_Lm (Tomato Leaf Mold)", ]; @override List<Widget> buildActions(BuildContext context) { // actions to perform in search bar return [ IconButton( icon: Icon(Icons.clear), onPressed: () { query = ""; }) ]; } @override Widget buildLeading(BuildContext context) { // what u want in the leading icon / side of app bar (left side) return IconButton( icon: AnimatedIcon( icon: AnimatedIcons.menu_arrow, progress: transitionAnimation), onPressed: () { close(context, null); }); } @override Widget buildResults(BuildContext context) { // shows result based on selection //final rec = query == rectangleList. return ListView.builder( itemCount: rectangleList.length, itemBuilder: (context, index) { if (rectangleList[index]['title'] == query) { return Rectangle( diseaseName: rectangleList[index]['name'], diseaseTitle: rectangleList[index]['title'], image: rectangleList[index]['image'], //onPress: rectangleList[index]['onTap'], onPress: PlantNavigator.gotoPlant( context, rectangleList[index]['onTap']), ); } else { return Padding(padding: EdgeInsets.only(top: 0)); } }); } @override Widget buildSuggestions(BuildContext contexntext) { // shows while searching final suggestionList = query.isEmpty ? disease : diseaseTitle.where((element) => element.startsWith(query)).toList(); return ListView.builder( itemBuilder: (context, index) => ListTile( onTap: () { showResults(context); }, leading: Icon(Icons.location_city), title: RichText( text: TextSpan( text: suggestionList[index].substring(0, query.length), style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), children: [ TextSpan( text: suggestionList[index].substring(query.length), style: TextStyle(color: Colors.grey)) ])), ), itemCount: suggestionList.length, ); } }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/utilities/config.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; Color primaryGreen = Color(0xFF416D6D); List<BoxShadow> shadowList = [ BoxShadow(color: Colors.grey[300], blurRadius: 30, offset: Offset(0, 10)) ]; List<Map> categories = [ { 'name': 'Apple', 'icon': 'lib/images/apple.png', }, {'name': 'Cherry', 'icon': 'lib/images/cherry.png'}, {'name': 'Grape', 'icon': 'lib/images/grape.png'}, {'name': 'Maize', 'icon': 'lib/images/maize.png'}, {'name': 'Peach', 'icon': 'lib/images/peach.png'}, {'name': 'Pepper', 'icon': 'lib/images/pepper.png'}, {'name': 'Potato', 'icon': 'lib/images/potato.png'}, {'name': 'Raspberry', 'icon': 'lib/images/raspberry.png'}, {'name': 'Strawberry', 'icon': 'lib/images/strawberry.png'}, {'name': 'Squash', 'icon': 'lib/images/squash.png'}, {'name': 'Tomato', 'icon': 'lib/images/tomato.png'}, ];
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/utilities/appBarLayout.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fypapp/main.dart'; import 'package:fypapp/screens/classes/language.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/utilities/styles.dart'; class AppBarLayout extends StatefulWidget implements PreferredSizeWidget { final String title; const AppBarLayout({ this.title, }); @override _AppBarLayoutState createState() => _AppBarLayoutState(); @override // TODO: implement preferredSize Size get preferredSize => Size.fromHeight(kToolbarHeight); } class _AppBarLayoutState extends State<AppBarLayout> { void _changeLanguage(Language language) async { print(language.languageCode); Locale _temp = await setLocale(language.languageCode); MyApp.setLocale(context, _temp); } @override Widget build(BuildContext context) { return AppBar( title: Text( widget.title, style: TextStyles.AppBarText, ), automaticallyImplyLeading: false, backgroundColor: Colors.green, leading: InkWell( child: IconButton( icon: Icon(Icons.arrow_back_ios), onPressed: () { Navigator.pop(context); }, ), ), actions: <Widget>[ Padding( padding: EdgeInsets.all(8.0), child: DropdownButton( icon: Icon(Icons.language, color: Colors.white), underline: SizedBox(), items: Language.languageList() .map<DropdownMenuItem<Language>>((lang) => DropdownMenuItem( value: lang, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ Text( lang.name, style: TextStyle(fontSize: 30), ), Text(lang.flag) ], ))) .toList(), onChanged: (Language language) { _changeLanguage(language); }, ), ), ], ); } // @override // TODO: implement preferredSize //Size get preferredSize => Size.fromHeight(kToolbarHeight); }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/utilities/disease_list.dart
import 'dart:async'; import 'package:flutter/scheduler.dart'; import 'package:flutter/widgets.dart'; List<Map> diseaseList = [ {'title': "abr", 'diseaseName': "Apple - Black rot", 'onTap': "/ABRdisease"}, {'title': "as", 'diseaseName': "Apple - Apple Scab", 'onTap': "/ASdisease"}, { 'title': "ar", 'diseaseName': "Apple - Cedar Apple Rust", 'onTap': "/ARdisease" }, { 'title': "cpm", 'diseaseName': "Cherry Powdery Mildew", 'onTap': "/CPMdisease" }, { 'title': "g_ebm", 'diseaseName': "Grape Esca (Black measles)", 'onTap': "/GEBMdisease" }, {'title': "g_br", 'diseaseName': "Grape Black rot", 'onTap': "/GBRdisease"}, {'title': "g_Lb", 'diseaseName': "Grape Leaf blight", 'onTap': "/GLBdisease"}, { 'title': "mLb", 'diseaseName': "Maize Northern leaf blight", 'onTap': "/MLBdisease" }, { 'title': "mLs", 'diseaseName': "Maize Gray Leaf Spot", 'onTap': "/MLSdisease" }, {'title': "mcr", 'diseaseName': "Maize Common Rust", 'onTap': "/MCRdisease"}, { 'title': "pbs", 'diseaseName': "Peach bacterial spot", 'onTap': "/PBSdisease" }, { 'title': "pp_bs", 'diseaseName': "Pepper bacterial spot", 'onTap': "/PPBSdisease" }, { 'title': "po_eb", 'diseaseName': "Potato Early blight", 'onTap': "/POEBdisease" }, { 'title': "po_Lb", 'diseaseName': "Potato Late blight", 'sName': "Phytophthora infestans.", 'onTap': "/POLBdisease" }, { 'title': "sberry_Ls", 'diseaseName': "Strawberry Leaf scorch", 'onTap': "/SBERRYLSdisease" }, { 'title': "squ_pm", 'diseaseName': "Squash Powdery Mildew", 'onTap': "/SQUPMdisease" }, { 'title': "tom_bs", 'diseaseName': "Tomato Bacterial spot", 'onTap': "/TOMBSdisease" }, { 'title': "tom_eb", 'diseaseName': "Tomato Early blight", 'onTap': "/TOMEBdisease" }, { 'title': "tom_Lb", 'diseaseName': "Tomato Late blight", 'onTap': "/TOMLBdisease" }, { 'title': "tom_Lm", 'diseaseName': "Tomato Leaf Mold", 'onTap': "/TOMLMdisease" }, { 'title': "t_sLs", 'diseaseName': "Tomato Septoria Leaf Spot", 'onTap': "/TSLSdisease" }, { 'title': "t_tmv", 'diseaseName': "Tomato Mosaic Virus", 'onTap': "/TTMVdisease" }, { 'title': "t_smt", 'diseaseName': "Tomato Spider Mite", 'onTap': "/TSMTdisease" }, { 'title': "t_ts", 'diseaseName': "Tomato Target spot", 'onTap': "/TTSdisease" }, { 'title': "t_ty", 'diseaseName': "Tomato Yellow Leaf Curl Virus", 'onTap': "/TTYdisease" } ]; class DiseaseNavigator { static gotoPlant(BuildContext context, String route) { SchedulerBinding.instance.addPostFrameCallback((timeStamp) { Timer( Duration(seconds: 1), // () => Navigator.popAndPushNamed(context, route)); () => Navigator.pushNamed(context, route)); }); } }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/screens/plant_list.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plant_tabs/apple.dart'; import 'package:fypapp/utilities/styles.dart'; class PlantHomeScreen extends StatefulWidget { @override _PlantHomeScreenState createState() => _PlantHomeScreenState(); } class _PlantHomeScreenState extends State<PlantHomeScreen> { double xOffset = 0; double yOffset = 0; double scaleFactor = 1; @override Widget build(BuildContext context) { // var hei = MediaQuery.of(context).size.height; // var wid = MediaQuery.of(context).size.width; return Scaffold( appBar: AppBar( // title: Text( // "AgrikAI More food less stress", // style: TextStyles.AppBarText, // ), // centerTitle: true, backgroundColor: Colors.green, //leading: Icon(Icons.menu), title: Text( getTranslated(context, 'search'), ), actions: <Widget>[ IconButton( icon: Icon(Icons.search), onPressed: () { showSearch(context: context, delegate: DataSearch()); }) ], ), //drawer: Drawer(), body: // TabBarView(children: <Widget>[ //controller: tabController, Apple( color: Colors.green, ), // ]) ); } } // Container( // padding: // EdgeInsets.symmetric(horizontal: 20, vertical: 15), // margin: // EdgeInsets.symmetric(vertical: 30, horizontal: 20), // decoration: BoxDecoration( // borderRadius: BorderRadius.circular(20), // color: Colors.white), // child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: <Widget>[ // Icon( // Icons.search, // color: Colors.green[200], // ), // Text("Search plant"), // Icon(Icons.settings) // ])),
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/screens/disease.dart
import 'package:carousel_pro/carousel_pro.dart'; import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/utilities/appBarLayout.dart'; import 'package:fypapp/utilities/config.dart'; import 'package:fypapp/utilities/styles.dart'; import 'package:url_launcher/url_launcher.dart'; class Disease extends StatefulWidget { final String img1, img2, img3, diseaseTitle, diseaseName, sName, c0, c1, c2, c3, link; Disease( {this.img1, this.img2, this.img3, this.diseaseTitle, this.diseaseName, this.sName, this.c0, this.c1, this.c2, this.c3, this.link}); @override _DiseaseState createState() => _DiseaseState(); } class _DiseaseState extends State<Disease> { Future<void> launchURL(String url) async { if (await canLaunch(url)) { await launch( url, forceSafariVC: false, forceWebView: false, headers: <String, String>{'header_key': 'header_value'}, ); } else { throw 'Could not launch $url'; } } @override Widget build(BuildContext context) { var hei = MediaQuery.of(context).size.height; var wid = MediaQuery.of(context).size.width; // TODO: implement build Widget imageCarousel = Container( //height: MediaQuery.of(context).size.height * 0.05, height: hei * 0.38, child: Carousel( boxFit: BoxFit.cover, images: [ // Image.asset(img1), // Image.asset(img2), // Image.asset(img3), AssetImage(widget.img1), AssetImage(widget.img2), AssetImage(widget.img3), ], autoplay: false, animationCurve: Curves.fastOutSlowIn, animationDuration: Duration(milliseconds: 1000), dotSize: 4.0, indicatorBgPadding: 2.0, dotColor: Colors.greenAccent, //radius: Radius.circular(20), )); return Scaffold( appBar: AppBarLayout( title: "AGRIKai", ), body: Stack( children: <Widget>[ Positioned.fill( child: Column( children: <Widget>[ Expanded( child: Container(color: Colors.white), ), Expanded( child: Container( color: Colors.white, ), ) ], )), SingleChildScrollView( child: Padding( padding: EdgeInsets.only(top: 1.0), child: Column( children: <Widget>[ imageCarousel, SizedBox(height: hei * 0.007), Align( // align automatically took this to center alignment: Alignment.center, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.grey[350], boxShadow: shadowList), child: Container( padding: EdgeInsets.symmetric( horizontal: 20, vertical: 10), height: hei * 0.19, width: wid * 0.8, //responsible for the center child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( widget.diseaseTitle, style: TextStyles.DiseaseTitle, ), SizedBox( height: hei * 0.005, ), Text( widget.diseaseName, // getTranslated(context, widget.diseaseName) ?? // 'default', style: TextStyles.DiseaseName, ), SizedBox( height: hei * 0.005, ), Text( "${getTranslated(context, 'casual_agents')}: ${widget.sName}", style: TextStyles.DiseaseName, ), ], ))), ), Align( alignment: Alignment.bottomLeft, child: Container( padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), //height: hei * 0.4, width: wid * 0.8, //height: hei * 0.8, // padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("${getTranslated(context, 'causes')}", style: TextStyles.DiseaseTitle), SizedBox( height: hei * 0.007, ), Text(widget.c0, style: TextStyles.DiseaseName), SizedBox( height: hei * 0.02, ), Text("${getTranslated(context, 'control')}", style: TextStyles.DiseaseTitle), SizedBox( height: hei * 0.007, ), // Wrap( // direction: Axis.vertical, // children: <Widget>[ Text(widget.c1, style: TextStyles.DiseaseName), SizedBox( height: hei * 0.005, ), Text(widget.c2, style: TextStyles.DiseaseName), SizedBox( height: hei * 0.005, ), Text(widget.c3, style: TextStyles.DiseaseName), // ], // ), ], ), ), ), SizedBox( height: hei * 0.05, ), Container( //alignment: Alignment.bottomCenter, //padding: EdgeInsets.all(100.0), child: Container( height: hei * 0.12, padding: EdgeInsets.symmetric(horizontal: 15), margin: EdgeInsets.symmetric(horizontal: 20), decoration: BoxDecoration( color: Colors.grey[200], borderRadius: BorderRadius.only( topLeft: Radius.circular(40), topRight: Radius.circular(40)), ), child: Row( children: <Widget>[ Container( height: hei * 0.090, width: wid * 0.150, decoration: BoxDecoration( color: Colors.green, borderRadius: BorderRadius.circular(20)), child: Icon(Icons.favorite_border, color: Colors.white), ), SizedBox(width: wid * 0.035), Expanded( child: InkWell( onTap: () { launchURL(widget.link); }, child: Container( height: hei * 0.090, child: Center( child: Text( "${getTranslated(context, 'for_more_info')}\n\t\t${getTranslated(context, 'click_here')}", style: TextStyle( color: Colors.white, fontSize: 18), )), decoration: BoxDecoration( color: Colors.green, borderRadius: BorderRadius.circular(20)), ), ), ) ], ), ), ) ], ), )) ], ), ); } }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/screens/plant_tab.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:fypapp/utilities/config.dart'; class PlantTopTab extends StatelessWidget { final String plantName, plantIcon; final Color colorVal; PlantTopTab({this.plantName, this.plantIcon, this.colorVal}); @override Widget build(BuildContext context) { var hei = MediaQuery.of(context).size.height; var wid = MediaQuery.of(context).size.width; return Container( height: hei * 0.1, child: SizedBox( height: hei * 0.05, child: ListView.builder( scrollDirection: Axis.horizontal, //itemCount: categories.length, itemCount: 1, shrinkWrap: true, //controller: scrollController, itemBuilder: (context, index) { return Container( child: Column( // crossAxisAlignment: CrossAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Expanded( //flex: 2, child: Container( height: hei * 0.07, //width: 50, //padding: EdgeInsets.all(10), margin: EdgeInsets.only(left: 20), child: Image.asset( //categories[index]['icon'], plantIcon, height: hei * 0.07, width: wid * 0.15, ), decoration: BoxDecoration( color: colorVal, boxShadow: shadowList, borderRadius: BorderRadius.circular(10)), ), ), //Text(categories[index]['name']) Text( plantName, style: TextStyle(fontSize: 14, color: Colors.black), textAlign: TextAlign.center, ) ], ), ); }), ) // child: TabBar( // controller: tabController, // isScrollable: true, // indicatorColor: Colors.green, // unselectedLabelColor: Colors.transparent, // ), ); } }
0
mirrored_repositories/fypapp/lib
mirrored_repositories/fypapp/lib/screens/rectangle.dart
import 'package:flutter/material.dart'; import 'package:fypapp/utilities/config.dart'; import 'package:fypapp/utilities/styles.dart'; class Rectangle extends StatelessWidget { final String image, diseaseTitle, diseaseName; final Function onPress; Rectangle({this.image, this.diseaseTitle, this.diseaseName, this.onPress}); @override Widget build(BuildContext context) { var hei = MediaQuery.of(context).size.height; return Container( child: GestureDetector( onTap: onPress, child: Container( height: hei * 0.3, margin: EdgeInsets.symmetric( horizontal: 20, ), child: Row( children: <Widget>[ Expanded( //flex: 1, child: Stack( children: <Widget>[ Container( decoration: BoxDecoration( //color: Colors.green, color: Colors.transparent, borderRadius: BorderRadius.circular(20), boxShadow: shadowList), margin: EdgeInsets.only(top: 50, bottom: 50), ), Align( alignment: Alignment.center, child: Image.asset( image, height: hei * 0.15, //width: 250, ), ) ], )), Expanded( flex: 2, child: Container( //margin: EdgeInsets.only(top: 40, bottom: 40), height: hei * 0.15, decoration: BoxDecoration( color: Colors.white, boxShadow: shadowList, borderRadius: BorderRadius.only( topRight: Radius.circular(20), bottomRight: Radius.circular(20))), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text( diseaseTitle, style: TextStyles.DiseaseTitle, ), SizedBox( height: hei * 0.01, ), Text( diseaseName, style: TextStyles.DiseaseName, ), ], ), )) ], ), ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/peach/peach_bacterial.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class PBSdisease extends StatefulWidget { @override _PBSdiseaseState createState() => _PBSdiseaseState(); } class _PBSdiseaseState extends State<PBSdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/peach/pbs1.JPG', img2: 'lib/images/peach/pbs2.JPG', img3: 'lib/images/peach/pbs3.JPG', diseaseTitle: "pbs", diseaseName: getTranslated(context, 'peach_spot'), sName: "Xanthomonas camperis pv. pruni.", c0: getTranslated(context, 'pbs0'), c1: "1. ${getTranslated(context, 'pbs1')}", c2: "2. ${getTranslated(context, 'pbs2')}", c3: "3. ${getTranslated(context, 'pbs3')}", link: "https://www.gardeningknowhow.com/edible/fruits/peach/bacterial-spot-on-peach-trees.htm", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/squash/squash_mildew.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class SQUPMdisease extends StatefulWidget { @override _SQUPMdiseaseState createState() => _SQUPMdiseaseState(); } class _SQUPMdiseaseState extends State<SQUPMdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/squash/squpm1.JPG', img2: 'lib/images/squash/squpm2.JPG', img3: 'lib/images/squash/squpm3.JPG', diseaseTitle: "squ_pm", diseaseName: getTranslated(context, 'squash_powdery'), sName: "Pseudocercospora vitis.", c0: getTranslated(context, 'squpm0'), c1: "1. ${getTranslated(context, 'squpm1')}", c2: "2. ${getTranslated(context, 'squpm2')}", c3: "3. ${getTranslated(context, 'squpm3')}", link: "https://extension.umn.edu/diseases/powdery-mildew-cucurbits#:~:text=Powdery%20mildew%2C%20mainly%20caused%20by,reduce%20yield%20and%20fruit%20quality.", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/cherry/cherry_mildew.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class CPMdisease extends StatefulWidget { @override _CPMdiseaseState createState() => _CPMdiseaseState(); } class _CPMdiseaseState extends State<CPMdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/cherry/cpm1.JPG', img2: 'lib/images/cherry/cpm2.JPG', img3: 'lib/images/cherry/cpm3.JPG', diseaseTitle: "cpm", diseaseName: getTranslated(context, 'cherry_powdery'), sName: "Podosphaera clandestina", c0: getTranslated(context, 'cpm0'), c1: "1. ${getTranslated(context, 'cpm1')}", c2: "2. ${getTranslated(context, 'cpm2')}", c3: "3. ${getTranslated(context, 'cpm3')}", link: "https://dengarden.com/gardening/Organic-Methods-of-Exterminating-Powdery-Mildew", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/apple/apple_scab.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class ASdisease extends StatefulWidget { @override _ASdiseaseState createState() => _ASdiseaseState(); } class _ASdiseaseState extends State<ASdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/apple/as1.JPG', img2: 'lib/images/apple/as2.JPG', img3: 'lib/images/apple/as3.JPG', diseaseTitle: "as", diseaseName: getTranslated(context, 'apple_scab'), sName: "Venturia inaequalis", c0: getTranslated(context, 'as0'), c1: "1. ${getTranslated(context, 'as1')}", c2: "2. ${getTranslated(context, 'as2')}", c3: "3. ${getTranslated(context, 'as3')}", link: "https://www.planetnatural.com/pest-problem-solver/plant-disease/apple-scab/", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/apple/apple_blackrot.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class ABRdisease extends StatefulWidget { @override _ABRdiseaseState createState() => _ABRdiseaseState(); } class _ABRdiseaseState extends State<ABRdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/apple/abr1.JPG', img2: 'lib/images/apple/abr2.JPG', img3: 'lib/images/apple/abr3.JPG', diseaseTitle: "abr", diseaseName: getTranslated(context, 'apple_black_rot'), sName: "Diplodia seriata", c0: getTranslated(context, 'abr0'), c1: "1. ${getTranslated(context, 'abr1')}", c2: "2. ${getTranslated(context, 'abr2')}", c3: "3. ${getTranslated(context, 'abr3')}", link: "https://extension.umn.edu/plant-diseases/black-rot-apple", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/apple/cedar_applerust.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class ARdisease extends StatefulWidget { @override _ARdiseaseState createState() => _ARdiseaseState(); } class _ARdiseaseState extends State<ARdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/apple/ar1.JPG', img2: 'lib/images/apple/ar2.JPG', img3: 'lib/images/apple/ar3.JPG', diseaseTitle: "ar", diseaseName: getTranslated(context, 'apple_rust'), sName: "Gymnosporangium juniperi-virginianae", c0: getTranslated(context, 'ar0'), c1: "1. ${getTranslated(context, 'ar1')}", c2: "2. ${getTranslated(context, 'ar2')}", c3: "3. ${getTranslated(context, 'ar3')}", link: "https://extension.umn.edu/plant-diseases/cedar-apple-rust", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/pepper/pepper_bacterial.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class PPBSdisease extends StatefulWidget { @override _PPBSdiseaseState createState() => _PPBSdiseaseState(); } class _PPBSdiseaseState extends State<PPBSdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/pepper/ppbs1.JPG', img2: 'lib/images/pepper/ppbs2.JPG', img3: 'lib/images/pepper/ppbs3.JPG', diseaseTitle: "pp_bs", diseaseName: getTranslated(context, 'pepper_spot'), sName: "Xanthomonas campestris pv. vesicatoria.", c0: getTranslated(context, 'ppbs0'), c1: "1. ${getTranslated(context, 'ppbs0')}", c2: "2. ${getTranslated(context, 'ppbs1')}", c3: "3. ${getTranslated(context, 'ppbs2')}", link: "https://extension.umd.edu/hgic/topics/bacterial-leaf-spot-pepper-vegetables#:~:text=Common%20Pepper%20Disease,a%20symptom%20of%20bacterial%20spot.&text=Bacterial%20leaf%20spot%20is%20spread,working%20with%20wet%2C%20infected%20plants.", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_latem.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TOMLMdisease extends StatefulWidget { @override _TOMLMdiseaseState createState() => _TOMLMdiseaseState(); } class _TOMLMdiseaseState extends State<TOMLMdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tomLm1.JPG', img2: 'lib/images/tomato/tomLm2.JPG', img3: 'lib/images/tomato/tomLm3.JPG', diseaseTitle: "tom_Lm", diseaseName: getTranslated(context, 'tomato_late_mold'), sName: "Passalora fulva.", c0: getTranslated(context, 'tomlm0'), c1: "1. ${getTranslated(context, 'tomlm1')}", c2: "2. ${getTranslated(context, 'tomlm2')}", c3: "3. ${getTranslated(context, 'tomlm3')}", link: "https://extension.umn.edu/diseases/leaf-mold-tomato", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_mosaicv.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TTMVdisease extends StatefulWidget { @override _TTMVdiseaseState createState() => _TTMVdiseaseState(); } class _TTMVdiseaseState extends State<TTMVdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/ttmv1.JPG', img2: 'lib/images/tomato/ttmv2.JPG', img3: 'lib/images/tomato/ttmv3.JPG', diseaseTitle: "t_tmv", diseaseName: getTranslated(context, 'tomato_mosaic_virus'), sName: "Tobamovirus.", c0: getTranslated(context, 'ttmv0'), c1: "1. ${getTranslated(context, 'ttmv1')}", c2: "2. ${getTranslated(context, 'ttmv2')}", c3: "3. ${getTranslated(context, 'ttmv3')}", link: "https://www.planetnatural.com/pest-problem-solver/plant-disease/mosaic-virus/", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_spiderm.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TSMTdisease extends StatefulWidget { @override _TSMTdiseaseState createState() => _TSMTdiseaseState(); } class _TSMTdiseaseState extends State<TSMTdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tsmt1.JPG', img2: 'lib/images/tomato/tsmt2.JPG', img3: 'lib/images/tomato/tsmt3.JPG', diseaseTitle: "t_smt", diseaseName: getTranslated(context, 'tomato_spider_mite'), sName: "Pseudocercospora vitis.", c0: getTranslated(context, 'tsmt0'), c1: "1. ${getTranslated(context, 'tsmt1')}", c2: "2. ${getTranslated(context, 'tsmt2')}", c3: "3. ${getTranslated(context, 'tsmt3')}", link: "https://homeguides.sfgate.com/avoid-spider-mites-tomato-garden-73368.html#:~:text=Spider%20mites%20(Tetranychus%20spp.),pest%20problems%20of%20tomato%20plants.", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_yellow.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TTYdisease extends StatefulWidget { @override _TTYdiseaseState createState() => _TTYdiseaseState(); } class _TTYdiseaseState extends State<TTYdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tty1.JPG', img2: 'lib/images/tomato/tty2.JPG', img3: 'lib/images/tomato/tty3.JPG', diseaseTitle: "t_ty", diseaseName: getTranslated(context, 'tomato_yellow'), sName: "Begomovirus.", c0: getTranslated(context, 'tty0'), c1: "1. ${getTranslated(context, 'tty1')}", c2: "2. ${getTranslated(context, 'tty2')}", c3: "3. ${getTranslated(context, 'tty3')}", link: "https://www2.ipm.ucanr.edu/agriculture/tomato/Tomato-Yellow-Leaf-Curl/", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_lateb.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TOMLBdisease extends StatefulWidget { @override _TOMLBdiseaseState createState() => _TOMLBdiseaseState(); } class _TOMLBdiseaseState extends State<TOMLBdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tomLb1.JPG', img2: 'lib/images/tomato/tomLb2.JPG', img3: 'lib/images/tomato/tomLb3.JPG', diseaseTitle: "tom_Lb", diseaseName: getTranslated(context, 'tomato_late_blight'), sName: "Phytophthora infestans.", c0: getTranslated(context, 'tomlb0'), c1: "1. ${getTranslated(context, 'tomlb1')}", c2: "2. ${getTranslated(context, 'tomlb2')}", c3: "3. ${getTranslated(context, 'tomlb3')}", link: "https://extension.umn.edu/diseases/late-blight#:~:text=Late%20blight%20is%20a%20potentially,famine%20of%20the%20late%201840s.", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_leafspot.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TSLSdisease extends StatefulWidget { @override _TSLSdiseaseState createState() => _TSLSdiseaseState(); } class _TSLSdiseaseState extends State<TSLSdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tsLs1.JPG', img2: 'lib/images/tomato/tsLs2.JPG', img3: 'lib/images/tomato/tsLs3.JPG', diseaseTitle: "t_sLs", diseaseName: getTranslated(context, 'tomato_leaf_spot'), sName: "Septoria lycopersici.", c0: getTranslated(context, 'tsls0'), c1: "1. ${getTranslated(context, 'tsls1')}", c2: "2. ${getTranslated(context, 'tsls2')}", c3: "3. ${getTranslated(context, 'tsls3')}", link: "https://www.missouribotanicalgarden.org/gardens-gardening/your-garden/help-for-the-home-gardener/advice-tips-resources/pests-and-problems/diseases/fungal-spots/septoria-leaf-spot-of-tomato.aspx#:~:text=Septoria%20leaf%20spot%20is%20caused,weather%20persists%20for%20extended%20periods.&text=Septoria%20leaf%20spot%20usually%20appears,after%20the%20first%20fruit%20sets.", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_earlyb.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TOMEBdisease extends StatefulWidget { @override _TOMEBdiseaseState createState() => _TOMEBdiseaseState(); } class _TOMEBdiseaseState extends State<TOMEBdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tomeb1.JPG', img2: 'lib/images/tomato/tomeb2.JPG', img3: 'lib/images/tomato/tomeb3.JPG', diseaseTitle: "tom_eb", diseaseName: getTranslated(context, 'tomato_early_blight'), sName: "Alternaria solani.", c0: getTranslated(context, 'tomeb0'), c1: "1. ${getTranslated(context, 'tomeb1')}", c2: "2. ${getTranslated(context, 'tomeb2')}", c3: "3. ${getTranslated(context, 'tomeb3')}", link: "https://extension.umn.edu/diseases/early-blight-tomato", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_bacterial.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TOMBSdisease extends StatefulWidget { @override _TOMBSdiseaseState createState() => _TOMBSdiseaseState(); } class _TOMBSdiseaseState extends State<TOMBSdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tombs1.JPG', img2: 'lib/images/tomato/tombs2.JPG', img3: 'lib/images/tomato/tombs3.JPG', diseaseTitle: "tom_bs", diseaseName: getTranslated(context, 'tomato_bacterial_spot'), sName: "Xanthomonas vesicatoria", c0: getTranslated(context, 'tombs0'), c1: "1. ${getTranslated(context, 'tombs1')}", c2: "2. ${getTranslated(context, 'tombs2')}", c3: "3. ${getTranslated(context, 'tombs3')}", link: "https://extension.umn.edu/diseases/bacterial-spot-tomato-and-pepper#cultural-control-1875511", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/tomato/tomato_tspot.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class TTSdisease extends StatefulWidget { @override _TTSdiseaseState createState() => _TTSdiseaseState(); } class _TTSdiseaseState extends State<TTSdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/tomato/tts1.JPG', img2: 'lib/images/tomato/tts2.JPG', img3: 'lib/images/tomato/tts3.JPG', diseaseTitle: "t_ts", diseaseName: getTranslated(context, 'tomato_target_spot'), sName: "Corynespora cassiicola.", c0: getTranslated(context, 'tts0'), c1: "1. ${getTranslated(context, 'tts1')}", c2: "2. ${getTranslated(context, 'tts2')}", c3: "3. ${getTranslated(context, 'tts3')}", link: "https://www.pestnet.org/fact_sheets/tomato_target_spot_163.htm", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/sberry/sberry_scorch.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class SBERRYLSdisease extends StatefulWidget { @override _SBERRYLSdiseaseState createState() => _SBERRYLSdiseaseState(); } class _SBERRYLSdiseaseState extends State<SBERRYLSdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/sberry/sberryLs1.JPG', img2: 'lib/images/sberry/sberryLs2.JPG', img3: 'lib/images/sberry/sberryLs3.JPG', diseaseTitle: "sberry_Ls", diseaseName: getTranslated(context, 'strawberry_leaf'), sName: "Diplocarpon earliana.", c0: getTranslated(context, 'sberryls0'), c1: "1. ${getTranslated(context, 'sberryls1')}", c2: "2. ${getTranslated(context, 'sberryls2')}", c3: "3. ${getTranslated(context, 'sberryls3')}", link: "https://www.gardeningknowhow.com/edible/fruits/strawberry/strawberries-with-leaf-scorch.htm#:~:text=Scorched%20strawberry%20leaves%20are%20caused,on%20the%20topside%20of%20leaves.", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/maize/maize_leafspot.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class MLSdisease extends StatefulWidget { @override _MLSdiseaseState createState() => _MLSdiseaseState(); } class _MLSdiseaseState extends State<MLSdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/maize/mLs1.JPG', img2: 'lib/images/maize/mLs2.JPG', img3: 'lib/images/maize/mLs3.JPG', diseaseTitle: "mLs", diseaseName: getTranslated(context, 'maize_spot'), sName: "Cercospora zeae-maydis.", c0: getTranslated(context, 'mls0'), c1: "1. ${getTranslated(context, 'mls1')}", c2: "2. ${getTranslated(context, 'mls2')}", c3: "3. ${getTranslated(context, 'mls3')}", link: "https://cropwatch.unl.edu/plantdisease/sugarbeet/cercospora-leaf-spot", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/maize/maize_rust.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class MCRdisease extends StatefulWidget { @override _MCRdiseaseState createState() => _MCRdiseaseState(); } class _MCRdiseaseState extends State<MCRdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/maize/mcr1.JPG', img2: 'lib/images/maize/mcr2.JPG', img3: 'lib/images/maize/mcr3.JPG', diseaseTitle: "mcr", diseaseName: getTranslated(context, 'maize_common_rust'), sName: "Puccinia sorghi.", c0: getTranslated(context, 'mcr0'), c1: "1. ${getTranslated(context, 'mcr1')}", c2: "2. ${getTranslated(context, 'mcr2')}", c3: "3. ${getTranslated(context, 'mcr3')}", link: "https://www.pestnet.org/fact_sheets/maize_common_rust_225.pdf", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/maize/maize_leafblight.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class MLBdisease extends StatefulWidget { @override _MLBdiseaseState createState() => _MLBdiseaseState(); } class _MLBdiseaseState extends State<MLBdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/maize/mLb1.JPG', img2: 'lib/images/maize/mLb2.JPG', img3: 'lib/images/maize/mLb3.JPG', diseaseTitle: "mLb", diseaseName: getTranslated(context, 'maize_blight'), sName: "Exserohilum turcicum.", c0: getTranslated(context, 'mlb0'), c1: "1. ${getTranslated(context, 'mlb1')}", c2: "2. ${getTranslated(context, 'mlb2')}", c3: "3. ${getTranslated(context, 'mlb3')}", link: "https://www.pestnet.org/fact_sheets/maize_northern_leaf_blight_226.htm", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/potato/potato_lateb.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class POLBdisease extends StatefulWidget { @override _POLBdiseaseState createState() => _POLBdiseaseState(); } class _POLBdiseaseState extends State<POLBdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/potato/poLb1.JPG', img2: 'lib/images/potato/poLb2.JPG', img3: 'lib/images/potato/poLb3.JPG', diseaseTitle: "po_Lb", diseaseName: getTranslated(context, 'potato_late_blight'), sName: "Phytophthora infestans.", c0: getTranslated(context, 'polb0'), c1: "1. ${getTranslated(context, 'polb1')}", c2: "2. ${getTranslated(context, 'polb2')}", c3: "3. ${getTranslated(context, 'polb3')}", link: "https://www.ag.ndsu.edu/publications/crops/late-blight-in-potato", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/potato/potato_earlyb.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class POEBdisease extends StatefulWidget { @override _POEBdiseaseState createState() => _POEBdiseaseState(); } class _POEBdiseaseState extends State<POEBdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/potato/poeb1.JPG', img2: 'lib/images/potato/poeb2.JPG', img3: 'lib/images/potato/poeb3.JPG', diseaseTitle: "po_eb", diseaseName: getTranslated(context, 'potato_early_blight'), sName: "Alternaria solani.", c0: getTranslated(context, 'poeb0'), c1: "1. ${getTranslated(context, 'poeb1')}", c2: "2. ${getTranslated(context, 'poeb2')}", c3: "3. ${getTranslated(context, 'poeb3')}", link: "https://www.planetnatural.com/pest-problem-solver/plant-disease/early-blight/", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/grape/grape_blackrot.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class GBRdisease extends StatefulWidget { @override _GBRdiseaseState createState() => _GBRdiseaseState(); } class _GBRdiseaseState extends State<GBRdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/grape/gbr1.JPG', img2: 'lib/images/grape/gbr2.JPG', img3: 'lib/images/grape/gbr3.JPG', diseaseTitle: "g_br", diseaseName: getTranslated(context, 'grape_black_rot'), sName: "Guignardia bidwellii.", c0: getTranslated(context, 'gbr0'), c1: "1. ${getTranslated(context, 'gbr0')}", c2: "2. ${getTranslated(context, 'gbr1')}", c3: "3. ${getTranslated(context, 'gbr2')}", link: "http://www.missouribotanicalgarden.org/gardens-gardening/your-garden/help-for-the-home-gardener/advice-tips-resources/pests-and-problems/diseases/fruit-spots/black-rot-of-grapes.aspx#:~:text=Black%20rot%2C%20caused%20by%20the,effect%20is%20to%20the%20fruit.", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/grape/grape_blackmeasles.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class GEBMdisease extends StatefulWidget { @override _GEBMdiseaseState createState() => _GEBMdiseaseState(); } class _GEBMdiseaseState extends State<GEBMdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/grape/gebm1.JPG', img2: 'lib/images/grape/gebm2.JPG', img3: 'lib/images/grape/gebm3.JPG', diseaseTitle: "g_ebm", diseaseName: getTranslated(context, 'grape_esca'), sName: "Guignardia bidwellii.", c0: getTranslated(context, 'gebm0'), c1: "1. ${getTranslated(context, 'gebm1')}", c2: "2. ${getTranslated(context, 'gebm2')}", c3: "3. ${getTranslated(context, 'gebm3')}", link: "https://apsjournals.apsnet.org/doi/pdf/10.1094/PDIS.1999.83.5.404", ); } }
0
mirrored_repositories/fypapp/lib/screens/plants
mirrored_repositories/fypapp/lib/screens/plants/grape/grape_leafblight.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/disease.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; class GLBdisease extends StatefulWidget { @override _GLBdiseaseState createState() => _GLBdiseaseState(); } class _GLBdiseaseState extends State<GLBdisease> { @override Widget build(BuildContext context) { return Disease( img1: 'lib/images/grape/gLb1.JPG', img2: 'lib/images/grape/gLb2.JPG', img3: 'lib/images/grape/gLb3.JPG', diseaseTitle: "g_Lb", diseaseName: getTranslated(context, 'grape_leaf_blight'), sName: "Pseudocercospora vitis.", c0: getTranslated(context, 'glb0'), c1: "1. ${getTranslated(context, 'glb1')}", c2: "2. ${getTranslated(context, 'glb2')}", c3: "3. ${getTranslated(context, 'glb3')}", link: "https://www.goodfruit.com/11-tips-to-beat-grape-fungal-diseases/", ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/pepper_list.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/pepper/pepper_bacterial.dart'; import 'package:fypapp/screens/rectangle.dart'; class PepperList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "pp_bs", diseaseName: getTranslated(context, 'pepper_spot'), image: "lib/images/pepper/ppbs1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => PPBSdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/cherry_list.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/cherry/cherry_mildew.dart'; import 'package:fypapp/screens/rectangle.dart'; class CherryList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "cpm", diseaseName: getTranslated(context, 'cherry_powdery'), image: "lib/images/cherry/cpm1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => CPMdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/squash_list.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/squash/squash_mildew.dart'; import 'package:fypapp/screens/rectangle.dart'; class SquashList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "squ_pm", diseaseName: getTranslated(context, 'squash_powdery'), image: "lib/images/squash/squpm1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => SQUPMdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/apple.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plant_tab.dart'; import 'package:fypapp/screens/plant_tabs/apple_list.dart'; import 'package:fypapp/screens/plant_tabs/cherry_list.dart'; import 'package:fypapp/screens/plant_tabs/grape_list.dart'; import 'package:fypapp/screens/plant_tabs/maize_list.dart'; import 'package:fypapp/screens/plant_tabs/peach_list.dart'; import 'package:fypapp/screens/plant_tabs/pepper_list.dart'; import 'package:fypapp/screens/plant_tabs/potato_list.dart'; import 'package:fypapp/screens/plant_tabs/sberry_list.dart'; import 'package:fypapp/screens/plant_tabs/squash_list.dart'; import 'package:fypapp/screens/plant_tabs/tomato_list.dart'; class Apple extends StatefulWidget { Color color; Apple({this.color}); @override _AppleState createState() => _AppleState(); } class _AppleState extends State<Apple> with SingleTickerProviderStateMixin { TabController tabController; // int length; // int index; @override void initState() { // TODO: implement initState super.initState(); //print("TabController length: ${tabController.length}"); tabController = new TabController( length: 10, vsync: this, ); tabController.addListener(handleTabSelection); } void handleTabSelection() { setState(() { widget.color = Colors.green; }); } @override Widget build(BuildContext context) { return DefaultTabController( length: 10, child: Scaffold( appBar: AppBar( backgroundColor: Colors.green, automaticallyImplyLeading: false, bottom: PreferredSize( preferredSize: Size.fromHeight(10.0), child: TabBar( controller: tabController, isScrollable: true, //indicatorWeight: .0, unselectedLabelColor: Colors.white, tabs: <Widget>[ // Row( // children: <Widget>[ // Wrap( // direction: Axis.horizontal, // runSpacing: 4.0, // spacing: 2.0, // children: <Widget>[ Tab( child: PlantTopTab( plantIcon: "lib/images/apple.png", //plantName: "Apple", plantName: getTranslated(context, 'apple'), colorVal: tabController.index == 0 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/cherry.png", plantName: getTranslated(context, 'cherry'), colorVal: tabController.index == 1 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/grape.png", plantName: getTranslated(context, 'grape'), colorVal: tabController.index == 2 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/maize.png", plantName: getTranslated(context, 'maize'), colorVal: tabController.index == 3 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/peach.png", plantName: getTranslated(context, 'peach'), colorVal: tabController.index == 4 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/pepper.png", plantName: getTranslated(context, 'pepper'), colorVal: tabController.index == 5 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/potato.png", plantName: getTranslated(context, 'potato'), colorVal: tabController.index == 6 ? Colors.green : Colors.grey, ), ), // Tab( // child: PlantTopTab( // plantIcon: "lib/images/raspberry.png", // plantName: "Raspberry", // colorVal: // tabController.index == 7 ? Colors.green : Colors.grey, // ), // ), Tab( child: PlantTopTab( plantIcon: "lib/images/strawberry.png", plantName: getTranslated(context, 'strawberry'), colorVal: tabController.index == 7 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/squash.png", plantName: getTranslated(context, 'squash'), colorVal: tabController.index == 8 ? Colors.green : Colors.grey, ), ), Tab( child: PlantTopTab( plantIcon: "lib/images/tomato.png", plantName: getTranslated(context, 'tomato'), colorVal: tabController.index == 9 ? Colors.green : Colors.grey, ), ), ], ), // ], // ) // ]), ), ), body: TabBarView(controller: tabController, children: <Widget>[ AppleList(), CherryList(), GrapeList(), MaizeList(), PeachList(), PepperList(), PotatoList(), SberryList(), SquashList(), TomatoList() ]), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/grape_list.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/grape/grape_blackmeasles.dart'; import 'package:fypapp/screens/plants/grape/grape_blackrot.dart'; import 'package:fypapp/screens/plants/grape/grape_leafblight.dart'; import 'package:fypapp/screens/rectangle.dart'; class GrapeList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "g_ebm", diseaseName: getTranslated(context, 'grape_esca'), image: "lib/images/grape/gebm1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => GEBMdisease())); }, ), Rectangle( diseaseTitle: "g_br", diseaseName: getTranslated(context, 'grape_black_rot'), image: "lib/images/grape/gbr1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => GBRdisease())); }, ), Rectangle( diseaseTitle: "g_Lb", diseaseName: getTranslated(context, 'grape_leaf_blight'), image: "lib/images/grape/gLb1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => GLBdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/peach_list.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/peach/peach_bacterial.dart'; import 'package:fypapp/screens/rectangle.dart'; class PeachList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "pbs", diseaseName: getTranslated(context, 'peach_spot'), image: "lib/images/peach/pbs1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => PBSdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/potato_list.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/potato/potato_earlyb.dart'; import 'package:fypapp/screens/plants/potato/potato_lateb.dart'; import 'package:fypapp/screens/rectangle.dart'; class PotatoList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "po_eb", diseaseName: getTranslated(context, 'potato_early_blight'), image: "lib/images/potato/poeb1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => POEBdisease())); }, ), Rectangle( diseaseTitle: "po_Lb", diseaseName: getTranslated(context, 'potato_late_blight'), image: "lib/images/potato/poLb1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => POLBdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/sberry_list.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/sberry/sberry_scorch.dart'; import 'package:fypapp/screens/rectangle.dart'; class SberryList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "sberry_Ls", diseaseName: getTranslated(context, 'strawberry_leaf'), image: "lib/images/sberry/sberryLs1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => SBERRYLSdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/tomato_list.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/tomato/tomato_bacterial.dart'; import 'package:fypapp/screens/plants/tomato/tomato_earlyb.dart'; import 'package:fypapp/screens/plants/tomato/tomato_lateb.dart'; import 'package:fypapp/screens/plants/tomato/tomato_latem.dart'; import 'package:fypapp/screens/plants/tomato/tomato_leafspot.dart'; import 'package:fypapp/screens/plants/tomato/tomato_mosaicv.dart'; import 'package:fypapp/screens/plants/tomato/tomato_spiderm.dart'; import 'package:fypapp/screens/plants/tomato/tomato_tspot.dart'; import 'package:fypapp/screens/plants/tomato/tomato_yellow.dart'; import 'package:fypapp/screens/rectangle.dart'; class TomatoList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "tom_bs", diseaseName: getTranslated(context, 'tomato_bacterial_spot'), image: "lib/images/tomato/tombs1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TOMBSdisease())); }, ), Rectangle( diseaseTitle: "tom_eb", diseaseName: getTranslated(context, 'tomato_early_blight'), image: "lib/images/tomato/tomeb1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TOMEBdisease())); }, ), Rectangle( diseaseTitle: "tom_Lb", diseaseName: getTranslated(context, 'tomato_late_blight'), image: "lib/images/tomato/tomLb1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TOMLBdisease())); }, ), Rectangle( diseaseTitle: "tom_Lm", diseaseName: getTranslated(context, 'tomato_leaf_mold'), image: "lib/images/tomato/tomLm1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TOMLMdisease())); }, ), Rectangle( diseaseTitle: "t_sLs", diseaseName: getTranslated(context, 'tomato_leaf_spot'), image: "lib/images/tomato/tsLs1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TSLSdisease())); }, ), Rectangle( diseaseTitle: "t_tmv", diseaseName: getTranslated(context, 'tomato_mosaic_virus'), image: "lib/images/tomato/ttmv1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TTMVdisease())); }, ), Rectangle( diseaseTitle: "t_smt", diseaseName: getTranslated(context, 'tomato_spider_mite'), image: "lib/images/tomato/tsmt1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TSMTdisease())); }, ), Rectangle( diseaseTitle: "t_ts", diseaseName: getTranslated(context, 'tomato_target_spot'), image: "lib/images/tomato/tts1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TTSdisease())); }, ), Rectangle( diseaseTitle: "t_ty", diseaseName: getTranslated(context, 'tomato_yellow'), image: "lib/images/tomato/tty1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => TTYdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/maize_list.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/maize/maize_leafblight.dart'; import 'package:fypapp/screens/plants/maize/maize_leafspot.dart'; import 'package:fypapp/screens/plants/maize/maize_rust.dart'; import 'package:fypapp/screens/rectangle.dart'; class MaizeList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "mLb", diseaseName: getTranslated(context, 'maize_blight'), image: "lib/images/maize/mLb1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => MLBdisease())); }, ), Rectangle( diseaseTitle: "mLs", diseaseName: getTranslated(context, 'maize_spot'), image: "lib/images/maize/mLs1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => MLSdisease())); }, ), Rectangle( diseaseTitle: "mcr", diseaseName: getTranslated(context, 'maize_common_rust'), image: "lib/images/maize/mcr1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => MCRdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/plant_tabs/apple_list.dart
import 'package:flutter/material.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plants/apple/apple_blackrot.dart'; import 'package:fypapp/screens/plants/apple/apple_scab.dart'; import 'package:fypapp/screens/plants/apple/cedar_applerust.dart'; import 'package:fypapp/screens/rectangle.dart'; class AppleList extends StatelessWidget { @override Widget build(BuildContext context) { return Container( child: SingleChildScrollView( child: Column( children: <Widget>[ Rectangle( diseaseTitle: "abr", diseaseName: getTranslated(context, 'apple_black_rot'), image: "lib/images/apple/abr1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => ABRdisease())); }, ), Rectangle( diseaseTitle: "as", diseaseName: getTranslated(context, 'apple_scab'), image: "lib/images/apple/as1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => ASdisease())); }, ), Rectangle( diseaseTitle: "ar", diseaseName: getTranslated(context, 'apple_rust'), image: "lib/images/apple/ar1.JPG", onPress: () { Navigator.push(context, MaterialPageRoute(builder: (context) => ARdisease())); }, ), ], ), ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/classes/language.dart
class Language { final int id; final String name; final String flag; final String languageCode; Language(this.id, this.name, this.flag, this.languageCode); static List<Language> languageList() { return <Language>[ Language(1, "🇬🇧", "English", "en"), Language(2, "🇲🇾", "B. Melayu", "ms"), Language(3, "🇨🇳", "中文", "zh"), ]; } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/home/home_screen.dart
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:fypapp/main.dart'; import 'package:fypapp/screens/classes/language.dart'; import 'package:fypapp/screens/localization/localization_constants.dart'; import 'package:fypapp/screens/plant_list.dart'; import 'package:fypapp/utilities/disease_list.dart'; import 'package:fypapp/utilities/styles.dart'; import 'package:image_picker/image_picker.dart'; import 'package:tflite/tflite.dart'; import 'package:camera/camera.dart'; class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { bool loading = false; List _output; File _image; String n; //FileImage img; double imageWidth = 100.0; double imageHeight = 100.0; bool _dropdownShown = false; void _toggleDropdown() { setState(() { _dropdownShown = !_dropdownShown; }); } Future openCamera(BuildContext context) async { // open device camera //var image = await picker.getImage(source: ImageSource.camera); var image = await ImagePicker.pickImage(source: ImageSource.camera); setState(() { loading = true; //_image = File(image.path); _image = image; }); detectImage(image); Navigator.of(context).pop(); } openGallery(BuildContext context) async { // open device gallery var image = await ImagePicker.pickImage(source: ImageSource.gallery); if (image == null) return; setState(() { loading = true; //_image = File(image.path); _image = image; }); detectImage(image); Navigator.of(context).pop(); } pickVideo(BuildContext context) async { //var video = await picker.getVideo(source: ImageSource.gallery); var video = await ImagePicker.pickVideo(source: ImageSource.gallery); setState(() { loading = true; //_image = File(video.path); _image = video; }); detectImage(video); } loadModel() async { Tflite.close(); try { await Tflite.loadModel( model: "assets/model/detect.tflite", labels: "assets/model/labels.txt", ); } on PlatformException { print("Failed to load the model"); } } detectImage(File image) async { if (image == null) return; await ssdMobileNet(image); FileImage(image) .resolve(ImageConfiguration()) .addListener((ImageStreamListener((ImageInfo info, bool _) { setState(() { imageWidth = info.image.width.toDouble(); imageHeight = info.image.height.toDouble(); }); }))); setState(() { _image = image; loading = false; }); } detectVideo(File video) async { CameraImage img; var recognitions = await Tflite.detectObjectOnFrame( bytesList: img.planes.map((plane) { return plane.bytes; }).toList(), // required model: "SSDMobileNet", // imageHeight: img.height, // imageWidth: img.width, imageMean: 127.5, // defaults to 127.5 imageStd: 127.5, // defaults to 127.5 rotation: 90, // defaults to 90, Android only numResultsPerClass: 2, // defaults to 5 threshold: 0.1, // defaults to 0.1 asynch: true // defaults to true ); } Future<void> _showDialog(BuildContext context) { // dialog to show options of selecting picture from gallery or camera return showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text( //S.of(context).pick_an_option, getTranslated(context, 'pick_an_option'), //style: TextStyles.TitleBlackText, ), content: SingleChildScrollView( child: ListBody( children: <Widget>[ ListTile( leading: Icon( Icons.photo, ), title: Text( //S.of(context).gallery, getTranslated(context, 'upload_picture')), onTap: () { openGallery(context); }, ), ListTile( leading: Icon(Icons.camera_alt), title: Text(getTranslated(context, 'snap_picture')), onTap: () { openCamera(context); }, ) ], ), ), ); }); } ssdMobileNet(File image) async { var output = await Tflite.detectObjectOnImage( path: image.path, numResultsPerClass: 2, model: "SSDMobileNet", imageMean: 127.5, imageStd: 127.5, threshold: 0.5, numBoxesPerBlock: 1, asynch: true); setState(() { _output = output; }); } @override void initState() { // TODO: implement initState super.initState(); loading = true; loadModel().then((value) { setState(() { loading = false; }); }); } List<Widget> renderBoxes(Size screen) { // if (_output = null) return []; // if (imageWidth == null || imageHeight == null) return []; double factorX = screen.width; double factorY = imageHeight / imageHeight * screen.width; Color blue = Colors.blue; return _output?.map((re) { return Positioned( left: re["rect"]["x"] * factorX, //get left / x coordinate top: re["rect"]["y"] * factorY, //get y coordinate width: re["rect"]["w"] * factorX, height: re["rect"]["h"] * factorY, // left: re["rect"]["x"], //get left / x coordinate // top: re["rect"]["y"], //get y coordinate // width: re["rect"]["w"], // height: re["rect"]["h"], child: Container( decoration: BoxDecoration( border: Border.all(color: blue, width: 3), ), child: Text( "${re["detectedClass"]} ${(re["confidenceInClass"] * 100).toStringAsFixed(0)}%", style: TextStyle( background: Paint()..color = blue, color: Colors.white, fontSize: 15), ), ), ); })?.toList() ?? []; } void _changeLanguage(Language language) async { print(language.languageCode); Locale _temp = await setLocale(language.languageCode); MyApp.setLocale(context, _temp); } @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; var hei = MediaQuery.of(context).size.height; var wid = MediaQuery.of(context).size.width; List<Widget> stackChildren = []; stackChildren.add(Positioned( //top: 100.0, left: 0, //right: 0, //height: size.height / 1.5, width: size.width, child: Container( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, //crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ // SizedBox( // height: hei * 0.1, // ), _image == null ? Padding( padding: const EdgeInsets.only(top: 200.0), //padding: const EdgeInsets.all(200), child: Text(getTranslated(context, 'no_image')), ) : Image.file( _image, //width: wid, //height: 300, ), _output != null ? Column( children: <Widget>[ RaisedButton( color: Colors.red, onPressed: () { for (int i = 0; i < diseaseList.length; i++) { if (diseaseList[i]['title'] == _output[0]["detectedClass"]) { DiseaseNavigator.gotoPlant( context, diseaseList[i]['onTap']); //n = diseaseList[i]['diseaseName']; print(n); } else { print("title not found"); } } }, child: Text( "${_output[0]["detectedClass"]}", style: TextStyles.DiseaseTitle, ), ), // Padding( // padding: EdgeInsets.only(top: 20), // child: Text( // "$n", // style: TextStyles.DiseaseTitle, // ), // ), ], ) : //Text("Nothing"), Container(), // SizedBox( // height: hei * 0.1, // ), // RaisedButton( // onPressed: () { // pickVideo(context); // }, // child: Text("Upload Video"), // ) ], ), ))); stackChildren.addAll(renderBoxes(size)); if (loading) { stackChildren.add(Center( child: CircularProgressIndicator( backgroundColor: Colors.green, ), )); } return Scaffold( appBar: AppBar( title: Text("AGRIKai"), automaticallyImplyLeading: false, backgroundColor: Colors.green, actions: <Widget>[ Row( children: <Widget>[ Padding( padding: EdgeInsets.all(8.0), child: DropdownButton( icon: Icon(Icons.language, color: Colors.white), underline: SizedBox(), items: Language.languageList() .map<DropdownMenuItem<Language>>( (lang) => DropdownMenuItem( value: lang, child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ Text( lang.name, style: TextStyle(fontSize: 30), ), Text(lang.flag) ], ))) .toList(), onChanged: (Language language) { _changeLanguage(language); }, ), ), IconButton( icon: Icon(Icons.arrow_forward_ios), onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => PlantHomeScreen())); }) ], ) ], // actions: <Widget>[ // Padding( // padding: const EdgeInsets.all(0), // child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: <Widget>[ // IconButton( // icon: Icon(Icons.more_vert), onPressed: _toggleDropdown), // OverlayContainer( // show: _dropdownShown, // // Let's position this overlay to the right of the button. // position: OverlayContainerPosition(-50.0, 1.0), // // The content inside the overlay. // child: Container( // height: hei * 0.12, // padding: EdgeInsets.all(10), // margin: EdgeInsets.only( // top: 0, // ), // decoration: BoxDecoration( // color: Colors.white, // boxShadow: <BoxShadow>[ // BoxShadow( // color: Colors.grey[300], // blurRadius: 3, // spreadRadius: 6, // ) // ], // ), // child: Column( // children: <Widget>[ // Align( // alignment: Alignment.centerLeft, // child: InkWell( // onTap: () { // setState(() { // _dropdownShown = !_dropdownShown; // }); // }, // child: Text( // "Language", // style: TextStyle(fontSize: 15), // ), // ), // ), // Divider( // color: Colors.purple, // thickness: 10.0, // height: 20.0, // ), // Align( // alignment: Alignment.centerLeft, // child: InkWell( // onTap: () { // setState(() { // _dropdownShown = !_dropdownShown; // }); // Navigator.push( // context, // MaterialPageRoute( // builder: (context) => // PlantHomeScreen())); // }, // child: Text( // "Disease ", // style: TextStyle(fontSize: 15), // ), // ), // ) // ], // )), // ), // ], // ), // ), // ], ), body: GestureDetector( onTap: () { setState(() { _dropdownShown = false; }); }, child: Stack( children: stackChildren, ), ), floatingActionButton: FloatingActionButton( onPressed: () { _showDialog(context); }, tooltip: 'Pick Image', backgroundColor: Colors.green, child: Icon(Icons.add_a_photo), ), ); } @override void dispose() { // TODO: implement dispose Tflite.close(); super.dispose(); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/home/detect_video.dart
import 'dart:typed_data'; import 'package:camera/camera.dart'; import 'package:flutter/widgets.dart'; // CameraImage img; // Uint8List imageToByteListFloat32( // img.Image image, int inputSize, double mean, double std) { // var convertedBytes = Float32List(1 * inputSize * inputSize * 3); // var buffer = Float32List.view(convertedBytes.buffer); // int pixelIndex = 0; // for (var i = 0; i < inputSize; i++) { // for (var j = 0; j < inputSize; j++) { // var pixel = image.getPixel(j, i); // buffer[pixelIndex++] = (img.getRed(pixel) - mean) / std; // buffer[pixelIndex++] = (img.getGreen(pixel) - mean) / std; // buffer[pixelIndex++] = (img.getBlue(pixel) - mean) / std; // } // } // return convertedBytes.buffer.asUint8List(); // } // Uint8List imageToByteListUint8(img.Image image, int inputSize) { // var convertedBytes = Uint8List(1 * inputSize * inputSize * 3); // var buffer = Uint8List.view(convertedBytes.buffer); // int pixelIndex = 0; // for (var i = 0; i < inputSize; i++) { // for (var j = 0; j < inputSize; j++) { // var pixel = image.getPixel(j, i); // buffer[pixelIndex++] = img.getRed(pixel); // buffer[pixelIndex++] = img.getGreen(pixel); // buffer[pixelIndex++] = img.getBlue(pixel); // } // } // return convertedBytes.buffer.asUint8List(); // }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/home/box.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; class BoxContainer extends StatelessWidget { final Function onTap1, onTap2; final String text1, text2; BoxContainer({this.onTap1, this.onTap2, this.text1, this.text2}); @override Widget build(BuildContext context) { var hei = MediaQuery.of(context).size.height; var wid = MediaQuery.of(context).size.width; return Container( child: Stack( children: <Widget>[ Container( height: hei * 0.17, width: wid * 0.1, decoration: BoxDecoration( color: Colors.grey, ), child: Column( children: <Widget>[ InkWell( onTap: onTap1, child: Text(text1), ), Divider(), InkWell( onTap: onTap2, child: Text(text2), ) ], )), ], ), ); } }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/localization/demo_localizaton.dart
import 'dart:convert'; import 'package:flutter/material.dart'; import 'dart:convert'; import 'package:flutter/services.dart'; class DemoLocalizations { final Locale locale; DemoLocalizations(this.locale); static DemoLocalizations of(BuildContext context) { return Localizations.of<DemoLocalizations>(context, DemoLocalizations); } Map<String, String> _localizedvalues; Future load() async { //loading json file into a String String jsonStringValues = await rootBundle.loadString( 'lib/screens/lang/${locale.languageCode}.json'); //json file is based on selected language Map<String, dynamic> mappedJson = json.decode(jsonStringValues); _localizedvalues = mappedJson.map((key, value) => MapEntry(key, value.toString())); } String getTranslatedValue(String key) { return _localizedvalues[key]; } // static member of Localizations static const LocalizationsDelegate<DemoLocalizations> delegate = _DemoLocalizationsDelegate(); } class _DemoLocalizationsDelegate extends LocalizationsDelegate<DemoLocalizations> { const _DemoLocalizationsDelegate(); @override bool isSupported(Locale locale) { return ['en', 'ms', 'zh'].contains(locale.languageCode); } @override Future<DemoLocalizations> load(Locale locale) async { DemoLocalizations localizations = new DemoLocalizations(locale); await localizations.load(); return localizations; } @override bool shouldReload(_DemoLocalizationsDelegate old) => false; }
0
mirrored_repositories/fypapp/lib/screens
mirrored_repositories/fypapp/lib/screens/localization/localization_constants.dart
import 'package:flutter/cupertino.dart'; import 'package:fypapp/screens/localization/demo_localizaton.dart'; import 'package:shared_preferences/shared_preferences.dart'; String getTranslated(BuildContext context, String key) { return DemoLocalizations.of(context).getTranslatedValue(key); } // language Code const String ENGLISH = 'en'; const String MALAY = 'ms'; const String CHINESE = 'zh'; const String LANGUAGE_CODE = 'languageCode'; //get language code and persist language in shared preferences Future<Locale> setLocale(String languageCode) async { SharedPreferences _prefs = await SharedPreferences.getInstance(); await _prefs.setString(LANGUAGE_CODE, languageCode); return _locale(languageCode); } Locale _locale(String languageCode) { Locale _temp; switch (languageCode) { case ENGLISH: _temp = Locale(languageCode, 'GB'); break; case MALAY: _temp = Locale(languageCode, 'MY'); break; case CHINESE: _temp = Locale(languageCode, 'CN'); break; default: _temp = Locale(ENGLISH, 'GB'); } return _temp; } Future<Locale> getLocale() async { SharedPreferences _prefs = await SharedPreferences.getInstance(); String languageCode = _prefs.getString(LANGUAGE_CODE) ?? ENGLISH; //if this is null, we use ENGLISH as our default lang return _locale(languageCode); }
0
mirrored_repositories/fypapp
mirrored_repositories/fypapp/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:fypapp/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/football_application
mirrored_repositories/football_application/lib/main.dart
import 'package:app/views/about_page.dart'; // import 'package:app/views/home_page.dart'; import 'package:app/views/leage_page.dart'; import 'package:app/views/news_page.dart'; import 'package:app/views/table_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; // handle named routes void main() { WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( fontFamily: 'Vazir', primaryColor: Colors.white, canvasColor: Colors.white, cardColor: Colors.amber[100], appBarTheme: const AppBarTheme( backgroundColor: Colors.white, foregroundColor: Colors.white, elevation: 0, iconTheme: IconThemeData( color: Colors.white, ), ), scaffoldBackgroundColor: Colors.white, textTheme: const TextTheme( bodyLarge: TextStyle(color: Colors.black), bodyMedium: TextStyle(color: Colors.black), bodySmall: TextStyle(color: Colors.black), ), iconButtonTheme: IconButtonThemeData( style: ButtonStyle( iconColor: MaterialStateProperty.all(Colors.black), ), ), iconTheme: const IconThemeData( color: Colors.black, ), ), darkTheme: ThemeData( fontFamily: 'Vazir', primaryColor: Colors.black, canvasColor: Colors.black, cardColor: Colors.grey, appBarTheme: const AppBarTheme( backgroundColor: Colors.black, elevation: 0, iconTheme: IconThemeData( color: Colors.white, ), foregroundColor: Colors.white, ), scaffoldBackgroundColor: Colors.black, textTheme: const TextTheme( bodyLarge: TextStyle(color: Colors.white), bodyMedium: TextStyle(color: Colors.white), bodySmall: TextStyle(color: Colors.black), ), iconButtonTheme: IconButtonThemeData( style: ButtonStyle( iconColor: MaterialStateProperty.all(Colors.white), ), ), iconTheme: const IconThemeData( color: Colors.white, ), ), themeMode: ThemeMode.light, home: const MainPage(), ); } } class MainPage extends StatefulWidget { const MainPage({Key? key}) : super(key: key); @override State<MainPage> createState() => _MainPageState(); } class _MainPageState extends State<MainPage> { int _selectedIndex = 3; final dynamic _pages = [ const TablePage(), const LeagePage(), const NewsPage(), const AboutPage(), ].reversed.toList(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('فوتبالو', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, )), backgroundColor: Colors.deepOrangeAccent, centerTitle: true, elevation: 10, toolbarHeight: 60, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(bottom: Radius.elliptical(100, 100)), )), body: Padding( padding: const EdgeInsets.only(top: 15, bottom: 5, left: 5, right: 5), child: _pages[_selectedIndex], ), bottomNavigationBar: BottomNavigationBar( selectedLabelStyle: const TextStyle(fontWeight: FontWeight.bold), selectedIconTheme: const IconThemeData(size: 25), unselectedIconTheme: const IconThemeData(size: 25), showSelectedLabels: true, showUnselectedLabels: true, // revese the order of the items items: const [ BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.futbol), label: 'بازی های امروز', ), BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.tableList), label: 'جدول لیگ ها', ), BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.newspaper), label: 'اخبار', ), BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.circleInfo), label: 'درباره ما', ), ].reversed.toList(), currentIndex: _selectedIndex, selectedItemColor: Colors.deepOrange, unselectedItemColor: Colors.grey, onTap: (index) { setState(() { _selectedIndex = index; }); }, ), ); } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/detail_page.dart
import 'package:app/services/match_datail_service.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:tab_container/tab_container.dart'; import 'package:flutter/material.dart'; class MatchDetailPage extends StatefulWidget { final int matchId; const MatchDetailPage({Key? key, required this.matchId}) : super(key: key); @override State<MatchDetailPage> createState() => _MatchDetailPageState(); } class _MatchDetailPageState extends State<MatchDetailPage> { // ignore: non_constant_identifier_names, prefer_typing_uninitialized_variables var MatchData; bool isLoaded = false; @override void initState() { super.initState(); fetchDataDetail(); } fetchDataDetail() async { try { MatchData = await fetchMatchDetail(widget.matchId); if (MatchData != null) { setState(() { isLoaded = true; }); } } catch (e) { fetchDataDetail(); } } @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; double roundWidth = width / 6; double gap = width / 12; double textboxsize = width / 8; double fontsize = width / 27; double fontsize2 = width / 30; if (isLoaded) { var date = DateTime.fromMillisecondsSinceEpoch( MatchData["data"]["info"]['timestamp'] * 1000); return Scaffold( body: Center( child: Scaffold( backgroundColor: Colors.white, appBar: AppBar( title: const Text('فوتبالو', style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold)), backgroundColor: Colors.deepOrangeAccent, centerTitle: true, elevation: 10, toolbarHeight: 60, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(bottom: Radius.elliptical(100, 100)), ), ), body: Column( mainAxisSize: MainAxisSize.max, children: [ const SizedBox( height: 20, ), Container( // color: Colors.white, height: 150, width: width * 0.95, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Theme.of(context).cardColor, ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: roundWidth, height: roundWidth, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), image: DecorationImage( image: CachedNetworkImageProvider( MatchData["data"]["info"]['home_team']['logo'] ?? "https://i.pravatar.cc/100?img=0", ), fit: BoxFit.cover, ), ), ), const SizedBox( width: 10, ), SizedBox( width: textboxsize, child: Text( MatchData["data"]["info"]['home_team']['name_fa'] ?? MatchData["data"]["info"]['home_team']['name_en'], maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: fontsize, color: Theme.of(context).textTheme.bodySmall?.color), textAlign: TextAlign.center, textDirection: TextDirection.rtl, textWidthBasis: TextWidthBasis.parent, ), ), SizedBox( width: gap, ), MatchData["data"]["info"]['match_started'] ? Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ const SizedBox( height: 50, ), Text( '${MatchData["data"]["info"]['home_team_score']} - ${MatchData["data"]["info"]['away_team_score']}', style: TextStyle( fontSize: fontsize2, fontWeight: FontWeight.bold, color: Theme.of(context) .textTheme .bodySmall ?.color), ), const SizedBox( height: 8, ), Text(MatchData["data"]["info"]['status'], textAlign: TextAlign.values[1], style: TextStyle( fontSize: fontsize2, color: Theme.of(context) .textTheme .bodySmall ?.color)), ], ) : Text( '${date.hour}:${date.minute}', style: TextStyle( fontWeight: FontWeight.bold, color: Theme.of(context) .textTheme .bodySmall ?.color), ), SizedBox( width: gap, ), SizedBox( width: textboxsize, child: Text( MatchData["data"]["info"]['away_team']['name_fa'] ?? MatchData["data"]["info"]['away_team']['name_en'], maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: fontsize, color: Theme.of(context).textTheme.bodySmall?.color), textAlign: TextAlign.center, textDirection: TextDirection.rtl, textWidthBasis: TextWidthBasis.parent, ), ), const SizedBox( width: 10, ), Container( width: roundWidth, height: roundWidth, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), image: DecorationImage( image: CachedNetworkImageProvider( MatchData["data"]["info"]['away_team']['logo'] ?? "https://i.pravatar.cc/100?img=80", ), fit: BoxFit.cover, ), ), ), ], ), ), // tab view // const SizedBox( // height: 20, // ), // const Divider( // height: 2, // color: Colors.deepOrangeAccent, // thickness: 2, // ), const SizedBox( height: 20, ), SizedBox( height: 450, width: width * 0.95, child: TabContainer( color: Theme.of(context).cardColor, onEnd: () { print("x"); }, tabs: const ['رو در رو', 'اخبار', 'اتفاقات'], children: [ Container( // width: width * 0.95, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Theme.of(context).cardColor, ), child: const Column( children: [ SizedBox(height: 10), Text(" رو در رو"), Text(" رو در رو"), Text(" رو در رو"), Text(" رو در رو"), Text(" رو در رو"), SizedBox(height: 10), ], ), ), Container( // width: width * 0.95, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Theme.of(context).cardColor, ), child: const Column( children: [ SizedBox(height: 10), Text(" اخبار"), Text(" اخبار"), Text(" اخبار"), Text(" اخبار"), Text(" اخبار"), SizedBox(height: 10), ], ), ), Container( // width: width * 0.95, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Theme.of(context).cardColor, ), child: const Column( children: [ SizedBox(height: 10), Text(" اتفاقات"), Text(" اتفاقات"), Text(" اتفاقات"), Text(" اتفاقات"), Text(" اتفاقات"), SizedBox(height: 10), ], ), ), ], ), ), Container( width: double.infinity, ), ], ), ), ), ); } else { return const Scaffold( body: Center( child: CircularProgressIndicator( color: Colors.deepOrangeAccent, strokeWidth: 7, valueColor: AlwaysStoppedAnimation<Color>(Colors.deepOrangeAccent), ), ), ); } } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/home_page.dart
// ignore_for_file: non_constant_identifier_names import 'package:app/services/footbali_services.dart'; import 'package:app/views/detail_page.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:grouped_list/grouped_list.dart'; class TableGamesLivePage extends StatefulWidget { final String tab_id; const TableGamesLivePage({Key? key, required this.tab_id}) : super(key: key); static String routeName = '/home'; @override State<TableGamesLivePage> createState() => _TableGamesLivePageState(); } class _TableGamesLivePageState extends State<TableGamesLivePage> { List competitions = []; bool isLoaded = false; @override void initState() { super.initState(); fetchDataFootbalis(); } fetchDataFootbalis() async { try { final response = await fetchFootbalis(tab: widget.tab_id); if (response != null) { setState(() { for (int i = 0; i < response['data']['competition_matches'].length; i++) { competitions .addAll(response['data']['competition_matches'][i]['matches']); } isLoaded = true; }); } } catch (e) { fetchDataFootbalis(); } } @override Widget build(BuildContext context) { if (isLoaded) { if (competitions.isEmpty) { return const Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.gamepad, size: 100, color: Colors.deepOrangeAccent, ), SizedBox( height: 20, ), Text( "هیچ بازی وجود ندارد", style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold), ), ], ), ); } return ScrollConfiguration( behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), child: GroupedListView<dynamic, String>( elements: competitions, groupBy: (element) => element['competition']['name_fa'], groupSeparatorBuilder: (String value) => Container( margin: const EdgeInsets.only( top: 25, right: 10, left: 10, bottom: 5), child: Container( padding: const EdgeInsets.all(11.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Colors.deepOrange, // boxShadow: [ // BoxShadow( // color: Colors.grey.withOpacity(0.5), // spreadRadius: 6, // blurRadius: 6, // offset: const Offset(0, 5), // ), // ], ), child: Text( value, textAlign: TextAlign.center, style: const TextStyle( color: Colors.white, fontSize: 20, ), ), ), ), itemBuilder: (context, element) { var date = DateTime.fromMillisecondsSinceEpoch( element['timestamp'] * 1000); return InkWell( highlightColor: Colors.transparent, hoverColor: Colors.transparent, splashColor: Colors.white, onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => MatchDetailPage( matchId: element["match_id"], ), ), ); // print(element["match_id"]); }, autofocus: false, child: Container( margin: const EdgeInsets.all(10), padding: const EdgeInsets.all(15), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Theme.of(context).cardColor, // boxShadow: [ // BoxShadow( // color: Colors.grey.withOpacity(0.5), // spreadRadius: 5, // blurRadius: 7, // offset: const Offset(0, 3), // ), // ], ), foregroundDecoration: BoxDecoration( borderRadius: BorderRadius.circular(12), border: Border.all( color: Colors.grey.withOpacity(0.5), ), ), child: Row( children: [ Container( width: 40, height: 40, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), image: DecorationImage( // image: NetworkImage( // element['home_team']['logo'], // ), image: CachedNetworkImageProvider( element['home_team']['logo'] ?? "https://i.pravatar.cc/100?img=0", ), fit: BoxFit.cover, ), ), ), const SizedBox( width: 10, ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( element['home_team']['name_fa'] ?? element['home_team']['name_en'], maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 14, color: Theme.of(context) .textTheme .bodySmall ?.color), textAlign: TextAlign.start, textDirection: TextDirection.rtl, textWidthBasis: TextWidthBasis.parent, ), ], ), ), const SizedBox( width: 16, ), element['match_started'] ? Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( '${element['home_team_score']} - ${element['away_team_score']}', style: TextStyle( fontWeight: FontWeight.bold, color: Theme.of(context) .textTheme .bodySmall ?.color), ), const SizedBox( height: 8, ), Text(element['status'], textAlign: TextAlign.values[1], style: TextStyle( color: Theme.of(context) .textTheme .bodySmall ?.color)), ], ) : Text( '${date.hour}:${date.minute}', style: TextStyle( fontWeight: FontWeight.bold, color: Theme.of(context) .textTheme .bodySmall ?.color), ), const SizedBox( width: 16, ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( element['away_team']['name_fa'] ?? element['away_team']['name_en'], maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 14, color: Theme.of(context) .textTheme .bodySmall ?.color), textAlign: TextAlign.start, textDirection: TextDirection.rtl, textWidthBasis: TextWidthBasis.parent, ), ], ), ), const SizedBox( width: 10, ), Container( width: 40, height: 40, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), image: DecorationImage( // image: NetworkImage( // element['away_team']['logo'], // ), image: CachedNetworkImageProvider( element['away_team']['logo'] ?? "https://i.pravatar.cc/100?img=80", ), fit: BoxFit.cover, ), ), ), ], ), ), ); }, )); } else { return const Scaffold( body: Center( child: CircularProgressIndicator( color: Colors.deepOrangeAccent, strokeWidth: 7, valueColor: AlwaysStoppedAnimation<Color>(Colors.deepOrangeAccent), ), ), ); } } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/about_page.dart
import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class AboutPage extends StatefulWidget { const AboutPage({Key? key}) : super(key: key); static String routeName = '/news'; @override State<AboutPage> createState() => _AboutPageState(); } class _AboutPageState extends State<AboutPage> { @override Widget build(BuildContext context) { return Scaffold( body: ScrollConfiguration( behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), child: SingleChildScrollView( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max, children: [ const SizedBox( height: 30, ), const CircleAvatar( radius: 70, backgroundImage: AssetImage('images/profile.jpg'), ), Container( margin: const EdgeInsets.only(top: 20), child: const Text( 'درباره ما', style: TextStyle( color: Colors.black, fontSize: 25, fontWeight: FontWeight.bold), ), ), const SizedBox( height: 5, ), Container( margin: const EdgeInsets.all(20), child: const Text( 'این برنامه توسط سیدعلی کمالی ساخته شده است.', textDirection: TextDirection.rtl, style: TextStyle( fontSize: 15, ), ), ), const SizedBox( height: 10, ), InkWell( onTap: () { launchUrl(Uri( scheme: 'https', host: 'github.com', path: 'irania9O', )); }, autofocus: false, child: Container( margin: const EdgeInsets.only( left: 25, right: 25, top: 10, bottom: 10), padding: const EdgeInsets.all(15), height: 60, foregroundDecoration: BoxDecoration( borderRadius: BorderRadius.circular(40), border: Border.all( color: Colors.grey.withOpacity(0.5), ), ), child: const Row( children: [ Expanded( child: Text( "Follow me on Github", style: TextStyle(fontSize: 14), maxLines: 1, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, ), ), SizedBox(width: 20), Icon( FontAwesomeIcons.github, size: 30, color: Colors.deepOrange, ), SizedBox( width: 20, ), ], ), ), ), InkWell( onTap: () { launchUrl(Uri( scheme: 'mailto', path: 'wwwwwq37@gmail.com', queryParameters: {'subject': 'فوتبالو!'})); }, autofocus: false, child: Container( margin: const EdgeInsets.only( left: 25, right: 25, top: 10, bottom: 10), padding: const EdgeInsets.all(15), height: 60, foregroundDecoration: BoxDecoration( borderRadius: BorderRadius.circular(40), border: Border.all( color: Colors.grey.withOpacity(0.5), ), ), child: const Row( children: [ Expanded( child: Text( "wwwwwq37@gmail.com", style: TextStyle(fontSize: 14), maxLines: 1, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, ), ), SizedBox(width: 20), Icon( FontAwesomeIcons.google, size: 30, color: Colors.deepOrange, ), SizedBox( width: 20, ), ], ), ), ), InkWell( onTap: () { launchUrl(Uri( scheme: 'tg', host: 'resolve', queryParameters: {'domain': 'irania9O'}, )); }, autofocus: false, child: Container( margin: const EdgeInsets.only( left: 25, right: 25, top: 10, bottom: 10), padding: const EdgeInsets.all(15), height: 60, foregroundDecoration: BoxDecoration( borderRadius: BorderRadius.circular(40), border: Border.all( color: Colors.grey.withOpacity(0.5), ), ), child: const Row( children: [ Expanded( child: Text( "Message me on Telegram", style: TextStyle(fontSize: 14), maxLines: 1, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, ), ), Icon( FontAwesomeIcons.telegram, size: 30, color: Colors.deepOrange, ), SizedBox( width: 20, ), ], ), ), ), InkWell( onTap: () { launchUrl(Uri( scheme: 'instagram', host: 'user', queryParameters: {'username': 'irania9O'}, )); }, autofocus: false, child: Container( margin: const EdgeInsets.only( left: 25, right: 25, top: 10, bottom: 10), padding: const EdgeInsets.all(15), height: 60, foregroundDecoration: BoxDecoration( borderRadius: BorderRadius.circular(40), border: Border.all( color: Colors.grey.withOpacity(0.5), ), ), child: const Row( children: [ Expanded( child: Text( "Follow me on Instagram", style: TextStyle(fontSize: 14), maxLines: 1, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, ), ), Icon( FontAwesomeIcons.instagram, size: 30, color: Colors.deepOrange, ), SizedBox( width: 20, ), ], ), ), ), ], ), ), ), ), ); } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/news_detail.dart
import 'package:app/services/news_detail_service.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart'; class NewsDetailPage extends StatefulWidget { final int newsId; const NewsDetailPage({Key? key, required this.newsId}) : super(key: key); @override State<NewsDetailPage> createState() => _NewsDetailPageState(); } class _NewsDetailPageState extends State<NewsDetailPage> { // ignore: non_constant_identifier_names, prefer_typing_uninitialized_variables var NewData; bool isLoaded = false; @override void initState() { super.initState(); fetchDataDetail(); } fetchDataDetail() async { try { NewData = await fetchNews(widget.newsId); if (NewData != null) { setState(() { isLoaded = true; }); } } catch (e) { fetchDataDetail(); } } @override Widget build(BuildContext context) { return isLoaded ? Scaffold( body: NestedScrollView( headerSliverBuilder: (context, innerBoxIsScrolled) => [ SliverAppBar( expandedHeight: 400, iconTheme: const IconThemeData( color: Colors.deepOrange, ), toolbarHeight: 60, floating: false, flexibleSpace: FlexibleSpaceBar( centerTitle: true, expandedTitleScale: 1, background: Image.network( NewData["data"]["details"]["news_image"][0]["url"], fit: BoxFit.cover, ), )), SliverToBoxAdapter( child: Container( padding: const EdgeInsets.all(5), margin: const EdgeInsets.all(10), child: Text( NewData["data"]["details"]["title"], textAlign: TextAlign.start, textDirection: TextDirection.rtl, style: const TextStyle( color: Colors.deepOrangeAccent, fontSize: 22, fontWeight: FontWeight.bold), ), ), ) ], body: SingleChildScrollView( padding: const EdgeInsets.all(5), child: HtmlWidget( NewData["data"]["details"]["body"], textStyle: const TextStyle( fontSize: 18, ), customStylesBuilder: (element) { if (element.localName == 'p') { return { 'direction': 'rtl', 'textAlign': 'right', 'padding': '8px', }; } return null; }, customWidgetBuilder: (element) { if (element.localName == 'img') { return Image.network( element.attributes['src']!, fit: BoxFit.cover, ); } return null; }, ), ), ), ) : Scaffold( body: Center( child: Scaffold( appBar: AppBar( title: const Text('فوتبالو', style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold)), backgroundColor: Colors.deepOrangeAccent, centerTitle: true, elevation: 10, toolbarHeight: 60, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical( bottom: Radius.elliptical(100, 100)), )), body: const Center( child: CircularProgressIndicator( color: Colors.deepOrangeAccent, strokeWidth: 7, valueColor: AlwaysStoppedAnimation<Color>(Colors.deepOrangeAccent), ), ), ), ), ); } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/table_leags.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; // import '../services/leage_table_service.dart'; import '../services/table_service.dart'; class TableLeags extends StatefulWidget { final int leageId; const TableLeags({Key? key, required this.leageId}) : super(key: key); static String routeName = '/table'; @override State<TableLeags> createState() => _TableLeagsState(); } class _TableLeagsState extends State<TableLeags> { // ignore: prefer_typing_uninitialized_variables, non_constant_identifier_names var TableData; bool isLoaded = false; String logoUrl = ""; @override void initState() { super.initState(); fetchLeagueTable(); } fetchLeagueTable() async { try { var leageId = widget.leageId; TableData = await fetchTable(leageId); if (TableData != null) { setState(() { for (int i = 0; i < TableData['data']['standing_tab'].length; i++) { if (TableData['data']['standing_tab'][i]['competition_id'] == leageId) { logoUrl = TableData['data']['standing_tab'][i]['logo']; } } isLoaded = true; }); } } catch (e) { fetchLeagueTable(); } } @override Widget build(BuildContext context) { return isLoaded ? Scaffold( body: ScrollConfiguration( behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), image: DecorationImage( opacity: 0.2, image: CachedNetworkImageProvider( logoUrl, ), fit: BoxFit.contain, ), ), child: ListView.builder( itemCount: TableData['data']['standing']['standings'][0] ['standings'] .length + 1, itemBuilder: (context, index) { if (index == 0) { return Container( margin: const EdgeInsets.all(5), padding: const EdgeInsets.only(bottom: 16), foregroundDecoration: const BoxDecoration( border: Border( bottom: BorderSide( color: Colors.grey, width: 0.5, ), ), ), child: Row( children: const [ SizedBox( width: 10, ), SizedBox( width: 20, ), SizedBox( width: 5, ), SizedBox( width: 140, ), SizedBox( width: 5, ), Expanded( child: Text( 'بازی', textAlign: TextAlign.center, style: TextStyle( fontSize: 10, ), ), ), SizedBox( width: 4, ), Expanded( child: Text( 'برد', textAlign: TextAlign.center, // font size style: TextStyle( fontSize: 10, ), ), ), SizedBox( width: 4, ), Expanded( child: Text( 'مساوی', textAlign: TextAlign.center, style: TextStyle( fontSize: 10, ), ), ), SizedBox( width: 4, ), Expanded( child: Text( 'باخت', textAlign: TextAlign.center, style: TextStyle( fontSize: 10, ), ), ), SizedBox( width: 4, ), Expanded( child: Text( 'تفاضل', textAlign: TextAlign.center, style: TextStyle( fontSize: 10, ), ), ), SizedBox( width: 4, ), Expanded( child: Text( 'امتیاز', textAlign: TextAlign.center, style: TextStyle( fontSize: 10, ), ), ), ].reversed.toList(), ), ); } index -= 1; return InkWell( child: Container( margin: const EdgeInsets.all(5), foregroundDecoration: const BoxDecoration( border: Border( bottom: BorderSide( color: Colors.grey, width: 0.5, ), ), ), child: Row( children: [ const SizedBox( width: 10, ), SizedBox( width: 20, child: Text( TableData['data']['standing']['standings'] [0]['standings'][index]['position'] .toString(), textAlign: TextAlign.right, maxLines: 1, ), ), Container( margin: const EdgeInsets.all(5), width: 30, height: 30, decoration: BoxDecoration( image: DecorationImage( // image: NetworkImage( // TableData['data']['standing'] // ['standings'][0]['standings'] // [index]['team']['logo'], // ), image: CachedNetworkImageProvider( TableData['data']['standing'] ['standings'][0]['standings'] [index]['team']['logo'], ), fit: BoxFit.cover, ), ), ), const SizedBox( width: 5, ), SizedBox( width: 100, child: Text( TableData['data']['standing']['standings'] [0]['standings'][index]['team'] ['name_fa'] .toString(), textAlign: TextAlign.right, textDirection: TextDirection.rtl, maxLines: 1, ), ), const SizedBox( width: 5, ), Expanded( child: Text( TableData['data']['standing']['standings'] [0]['standings'][index] ['match_played'] .toString(), textAlign: TextAlign.center, ), ), const SizedBox( width: 4, ), Expanded( child: Text( TableData['data']['standing']['standings'] [0]['standings'][index]['win'] .toString(), textAlign: TextAlign.center, ), ), const SizedBox( width: 4, ), Expanded( child: Text( TableData['data']['standing']['standings'] [0]['standings'][index]['draw'] .toString(), textAlign: TextAlign.center, ), ), const SizedBox( width: 4, ), Expanded( child: Text( TableData['data']['standing']['standings'] [0]['standings'][index]['lose'] .toString(), textAlign: TextAlign.center, ), ), const SizedBox( width: 4, ), Expanded( child: Text( (TableData['data']['standing']['standings'] [0]['standings'][index] ['goal_scored'] - TableData['data']['standing'] ['standings'][0] ['standings'][index] ['goal_against']) .toString(), textAlign: TextAlign.center, ), ), const SizedBox( width: 4, ), Expanded( child: Text( TableData['data']['standing']['standings'] [0]['standings'][index] ['overall_point'] .toString(), // TableData.data.standing.standings[0] // .standings[index].overallPoint // .toString(), textAlign: TextAlign.center, ), ), const SizedBox( width: 4, ), ].reversed.toList(), ), ), ); }, )))) : const Scaffold( body: Center( child: CircularProgressIndicator( color: Colors.deepOrangeAccent, strokeWidth: 7, valueColor: AlwaysStoppedAnimation<Color>(Colors.deepOrangeAccent), ), ), ); } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/news_page.dart
import 'package:app/views/news_detail.dart'; import 'package:flutter/material.dart'; import 'package:shamsi_date/shamsi_date.dart'; import '../services/news_service.dart'; class NewsPage extends StatefulWidget { const NewsPage({Key? key}) : super(key: key); static String routeName = '/news'; @override State<NewsPage> createState() => _NewsPageState(); } class _NewsPageState extends State<NewsPage> { // ignore: prefer_typing_uninitialized_variables, non_constant_identifier_names var NewsData; int cursor = DateTime.now().millisecondsSinceEpoch ~/ 1000; final controller = ScrollController(); bool isLoaded = false; @override void initState() { super.initState(); controller.addListener(() { if (controller.position.pixels == controller.position.maxScrollExtent) { fetchMoreData(); } }); fetchFirstData(); } fetchFirstData() async { try { NewsData = await fetchNews(cursor); if (NewsData != null) { setState(() { cursor = int.parse(NewsData['meta']['cursor']); isLoaded = true; }); } } catch (e) { fetchFirstData(); } } fetchMoreData() async { try { Map<String, dynamic>? moreData; moreData = await fetchNews(cursor); if (moreData != null) { setState(() { cursor = int.parse(moreData!['meta']['cursor']); NewsData['data']['news'].addAll(moreData['data']['news']); }); } } catch (e) { fetchMoreData(); } } @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return isLoaded ? ScrollConfiguration( behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), child: ListView.builder( controller: controller, itemCount: NewsData['data']['news'].length + 1, itemBuilder: (context, index) { if (index < NewsData['data']['news'].length) { if (NewsData['data']['news'][index]['language'] != 1) { return const SizedBox(); } JalaliFormatter timepost = Jalali.fromDateTime( DateTime.fromMillisecondsSinceEpoch( NewsData['data']['news'][index]['updated_at'] * 1000, ), ).formatter; return InkWell( highlightColor: Colors.deepOrangeAccent, // hoverColor: Colors.deepOrange, // splashColor: Colors.red, onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => NewsDetailPage( newsId: NewsData['data']['news'][index]['news_id'], ), ), ); }, autofocus: false, child: Container( margin: const EdgeInsets.all(10), padding: const EdgeInsets.all(15), height: 150, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), image: DecorationImage( opacity: 0.1, image: NetworkImage( NewsData['data']['news'][index]['news_image'][0] ['url'], ), fit: BoxFit.cover, ), ), foregroundDecoration: BoxDecoration( borderRadius: BorderRadius.circular(12), border: Border.all( color: Colors.grey.withOpacity(0.5), ), ), child: Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Padding( padding: const EdgeInsets.only(top: 20), child: Text( NewsData['data']['news'][index]['title'], style: const TextStyle(fontSize: 16), maxLines: 3, textAlign: TextAlign.start, overflow: TextOverflow.ellipsis, textDirection: TextDirection.rtl, textWidthBasis: TextWidthBasis.parent, ), ), const Spacer(), Text( "${timepost.d} ${timepost.mN} ${timepost.y}", style: const TextStyle( fontSize: 14, color: Colors.grey, ), textAlign: TextAlign.start, textDirection: TextDirection.rtl, textWidthBasis: TextWidthBasis.parent, ), ], ), ), const SizedBox(width: 20), Container( width: 80, height: 80, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), image: DecorationImage( image: NetworkImage( NewsData['data']['news'][index]['news_image'] [0]['url'], ), fit: BoxFit.cover, ), ), ), ], ), ), ); } else { return const SafeArea( child: Padding( padding: EdgeInsets.all(8.0), child: Center( child: CircularProgressIndicator( color: Colors.deepOrangeAccent, strokeWidth: 7, valueColor: AlwaysStoppedAnimation<Color>( Colors.deepOrangeAccent), ), ), ), ); } }, )) : const Scaffold( body: Center( child: CircularProgressIndicator( color: Colors.deepOrangeAccent, strokeWidth: 7, valueColor: AlwaysStoppedAnimation<Color>(Colors.deepOrangeAccent), ), ), ); } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/leage_page.dart
import 'package:app/views/table_leags.dart'; import 'package:flutter/material.dart'; class LeagePage extends StatefulWidget { const LeagePage({Key? key}) : super(key: key); @override State<LeagePage> createState() => _LeagePageState(); } class _LeagePageState extends State<LeagePage> { @override Widget build(BuildContext context) { return DefaultTabController( length: 6, initialIndex: 5, child: Scaffold( body: Column( children: <Widget>[ TabBar( isScrollable: true, indicatorColor: Colors.deepOrangeAccent, labelColor: Theme.of(context).textTheme.bodyLarge?.color, dividerColor: Colors.deepOrangeAccent, unselectedLabelColor: Colors.grey, automaticIndicatorColorAdjustment: true, padding: const EdgeInsets.only(bottom: 20), indicatorWeight: 5, tabs: const <Widget>[ Tab( text: 'لالیگا اسپانیا', ), Tab( text: 'لیگ برتر انگلیس', ), Tab( text: 'لیگ فرانسه', ), Tab( text: 'بوندس لیگا', ), Tab( text: 'سری آ ایتالیا', ), Tab( text: 'لیگ برتر خلیج فارس', ), ], ), const Expanded( child: TabBarView(children: [ TableLeags( leageId: 21, ), TableLeags( leageId: 9, ), TableLeags( leageId: 11, ), TableLeags( leageId: 12, ), TableLeags( leageId: 17, ), TableLeags( leageId: 14, ), ]), ), ], ), ), ); } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/table_page.dart
import 'package:app/services/footbali_services.dart'; import 'package:app/views/home_page.dart'; // import 'package:app/views/table_leags.dart'; import 'package:flutter/material.dart'; class TablePage extends StatefulWidget { const TablePage({Key? key}) : super(key: key); @override State<TablePage> createState() => _TablePageState(); } class _TablePageState extends State<TablePage> { bool isLoaded = false; List pages = []; @override void initState() { super.initState(); fetchDataFootbalis(); } fetchDataFootbalis() async { try { final response = await fetchFootbalis(); if (response != null) { setState(() { // for (int i = 0; i < response['data']['tabs'].length; i++) { // competitions // .addAll(response['data']['competition_matches'][i]['matches']); // pages.addAll(response['data']['tabs'][i]); // } pages = response['data']['tabs']; isLoaded = true; }); } } catch (e) { fetchDataFootbalis(); } } @override Widget build(BuildContext context) { if (isLoaded == true) { return DefaultTabController( length: pages.length, initialIndex: 4, child: Scaffold( body: Column( children: <Widget>[ TabBar( isScrollable: true, indicatorColor: Colors.deepOrangeAccent, labelColor: Theme.of(context).textTheme.bodyLarge?.color, dividerColor: Colors.deepOrangeAccent, unselectedLabelColor: Colors.grey, automaticIndicatorColorAdjustment: true, padding: const EdgeInsets.only(bottom: 20), indicatorWeight: 5, tabs: pages .map( (e) => Tab(text: e['title']), ) .toList() .reversed .toList()), Expanded( child: TabBarView( children: pages .map( (e) => TableGamesLivePage( tab_id: e['id']), //Tab(text: e['id']), ) .toList() .reversed .toList() // [ // table_games_live_page( // // leageId: 21, // ), // table_games_live_page( // // leageId: 9, // ), // table_games_live_page( // // leageId: 11, // ), // ] ), ), ], ), ), ); } else { return const Scaffold( body: Center( child: CircularProgressIndicator( color: Colors.deepOrangeAccent, strokeWidth: 7, valueColor: AlwaysStoppedAnimation<Color>(Colors.deepOrangeAccent), ), ), ); } } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/views/main_page.dart
import 'package:flutter/material.dart'; class MainPage extends StatefulWidget { const MainPage({Key? key}) : super(key: key); @override State<MainPage> createState() => _MainPageState(); } class _MainPageState extends State<MainPage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.deepOrange, elevation: 15, bottom: PreferredSize( preferredSize: const Size.fromHeight(40), child: Container( height: 40, margin: const EdgeInsets.all(16), transform: Matrix4.translationValues(0, -14, 0), padding: const EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Colors.white, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), ), ], ), child: const Row( children: [ Icon(Icons.search), SizedBox( width: 16, ), Expanded( child: TextField( decoration: InputDecoration( hintText: 'Search', border: InputBorder.none, ), ), ), ], ), ), ), ), bottomSheet: Container( height: 60, color: Colors.deepOrange, child: const Center( child: Text( 'Made with ❤️ by @irania9O', style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20, ), ), ), ), body: const Text('Hello World'), ); } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/services/match_datail_service.dart
import 'dart:convert'; import 'package:http/http.dart' as http; Future<Map<String, dynamic>?> fetchMatchDetail(matchId) async { await Future.delayed(const Duration(seconds: 1)); var client = http.Client(); var url = Uri.parse( 'https://api.footballi.net/api/v2/match/$matchId/overview?version=4'); var response = await client.get(url); if (response.statusCode == 200) { var jsonString = response.body; return json.decode(jsonString); } else { return null; } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/services/news_detail_service.dart
import 'dart:convert'; import 'package:http/http.dart' as http; Future<Map<String, dynamic>?> fetchNews(newsId) async { await Future.delayed(const Duration(seconds: 1)); var client = http.Client(); var url = Uri.parse('https://api.footballi.net/api/v2/news/$newsId?version=2'); var response = await client.get(url); if (response.statusCode == 200) { var jsonString = response.body; return json.decode(jsonString); } else { return null; } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/services/news_service.dart
import 'dart:convert'; import 'package:http/http.dart' as http; Future<Map<String, dynamic>?> fetchNews(cursor) async { await Future.delayed(const Duration(seconds: 1)); var client = http.Client(); var url = Uri.parse( 'https://api.footballi.net/api/v2/news/latest?version=2&cursor=$cursor'); var response = await client.get(url); if (response.statusCode == 200) { var jsonString = response.body; return json.decode(jsonString); } else { return null; } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/services/table_service.dart
import 'dart:convert'; import 'package:http/http.dart' as http; Future<Map<String, dynamic>?> fetchTable(id) async { await Future.delayed(const Duration(seconds: 1)); var client = http.Client(); var url = Uri.parse( 'https://api.footballi.net/api/v2/competition/$id/homepage?news=true&version=2'); var response = await client.get(url); if (response.statusCode == 200) { var jsonString = response.body; return json.decode(jsonString); } else { return null; } }
0
mirrored_repositories/football_application/lib
mirrored_repositories/football_application/lib/services/footbali_services.dart
import 'dart:convert'; import 'package:http/http.dart' as http; Future<Map<String, dynamic>?> fetchFootbalis({String tab = ""}) async { await Future.delayed(const Duration(seconds: 1)); var client = http.Client(); var url = Uri.parse('https://api.footballi.net/api/v2/match/tab/$tab?version=2'); var response = await client.get(url); if (response.statusCode == 200) { var jsonString = response.body; return json.decode(jsonString); } else { return null; } }
0
mirrored_repositories/football_application
mirrored_repositories/football_application/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:app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter_Travel_app
mirrored_repositories/Flutter_Travel_app/lib/second.dart
import 'package:flutter/material.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', home: Second(), ); } } class Second extends StatefulWidget { Second({Key key, this.title}) : super(key: key); final String title; @override _SecondState createState() => _SecondState(); } class _SecondState extends State<Second> { @override Widget build(BuildContext context) { return Scaffold( body: Column( children: <Widget>[ Stack( overflow: Overflow.visible, children: <Widget>[ Image.asset("assets/eiffel.png", height: 420.0, width: 420.0), Positioned( top: 35.0, left: 10.0, child: GestureDetector( onTap: (){ Navigator.pop(context); }, child: Icon(Icons.arrow_back_ios, color: Colors.black, size: 30.0,)), ), Positioned( top: 35.0, right: 10.0, child: GestureDetector( onTap: (){ Navigator.pop(context); }, child: Icon(Icons.menu, color: Colors.black, size: 30.0,)), ), Positioned( top: 375.0, child: Container( height: 450.0, width: 415.0, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0), ) ), child: Stack( children: <Widget>[ Padding( padding: const EdgeInsets.all(25.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("Eiffel Tower, Paris", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Nunito', fontSize: 30.0, ), ), SizedBox(height: 40.0,), Row( children: <Widget>[ Column( children: <Widget>[ Container( decoration: BoxDecoration( color: Colors.orange.withOpacity(0.1), borderRadius: BorderRadius.circular(20.0), ), child: Padding( padding: const EdgeInsets.all(20.0), child: Column( children: <Widget>[ Image.asset("assets/tower.png", height: 50.0, width: 50.0,), SizedBox(height: 25.0,), Container( decoration: BoxDecoration( color: Colors.white, border: Border.all(color: Colors.deepOrangeAccent), borderRadius: BorderRadius.circular(50.0), ), child: Padding( padding: const EdgeInsets.all(8.0), child: Text("4.7", style: TextStyle( color: Colors.black ),), ), ) ], ), ), ) ], ), SizedBox(width: 20.0,), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("The Eiffel Tower Tour", style: TextStyle( color: Colors.black, fontSize: 24.0, fontFamily: 'Nunito', fontWeight: FontWeight.bold ),), SizedBox(height: 40.0,), Text("Duration 1 hour", style: TextStyle( color: Colors.grey, fontSize: 20.0 ), ) ], ) ], ) ], ), ), Positioned( top: 290.0, child: Container( height: 300.0, width: 415.0, decoration: BoxDecoration( color: Colors.indigo[900], borderRadius: BorderRadius.only( topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0), ) ), child: Padding( padding: const EdgeInsets.all(25.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("2,305", style: TextStyle( color: Colors.white, fontFamily: 'Nunito', fontWeight: FontWeight.bold, fontSize: 30.0, ),), Text("Properties found", style: TextStyle( color: Colors.white, ),) ], ), Column( children: <Widget>[ Container( width: 150.0, height: 60.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20.0), color: Colors.lightBlue[50], ), child: Center( child: Text("See All", style: TextStyle( color: Colors.blue, fontFamily: 'Nunito', fontWeight: FontWeight.bold, fontSize: 20.0 ),), ), ) ], ) ], ), ), ), ) ], ), ), ), ], ) ], ), ); } }
0
mirrored_repositories/Flutter_Travel_app
mirrored_repositories/Flutter_Travel_app/lib/main.dart
import 'package:channel_travel_app/second.dart'; import 'package:flutter/material.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', home: MyMainPage(), ); } } class MyMainPage extends StatefulWidget { MyMainPage({Key key, this.title}) : super(key: key); final String title; @override _MyMainPageState createState() => _MyMainPageState(); } class _MyMainPageState extends State<MyMainPage> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Padding( padding: const EdgeInsets.only(right: 25.0, top: 35.0), child: Align( alignment: Alignment.topRight, child: Icon(Icons.menu, color: Colors.black, size: 40.0,)), ), Padding( padding: const EdgeInsets.only(top: 20.0, left: 25.0, right: 25.0), child: Text("Book unique homes and experiences", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Nunito', fontSize: 30.0, letterSpacing: 0.5, ),), ), Padding( padding: const EdgeInsets.only(top :25.0, left: 25.0, right: 25.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ Container( decoration: BoxDecoration( color: Colors.orangeAccent.withOpacity(0.8), borderRadius: BorderRadius.circular(20.0), ), child: Padding( padding: const EdgeInsets.only(left: 60.0, right: 60.0, top: 25.0, bottom: 25.0), child: Text("Hotels", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Nunito', fontSize: 18.0, ), ), ), ), Spacer(), Container( decoration: BoxDecoration( border: Border.all(color: Colors.grey), borderRadius: BorderRadius.circular(20.0), ), child: Padding( padding: const EdgeInsets.only(left: 60.0, right: 60.0, top: 25.0, bottom: 25.0), child: Text("Flights", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Nunito', fontSize: 18.0, ), ), ), ), ], ), ), Padding( padding: const EdgeInsets.only(top: 30.0, left: 25.0, right: 25.0), child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( children: <Widget>[ Container( decoration : BoxDecoration( borderRadius: BorderRadius.circular(20.0), color: Colors.lightBlue.withOpacity(0.3), ), child: Padding( padding: const EdgeInsets.all(15.0), child: Icon(Icons.location_on, color: Colors.lightBlue,), ), ), SizedBox(width: 20.0,), Text("Where", style: TextStyle( color: Colors.grey, fontSize: 20.0, ),) ], ), SizedBox(height: 10.0,), Divider( thickness: 1.0, ), SizedBox(height: 10.0,), Row( children: <Widget>[ Container( decoration : BoxDecoration( borderRadius: BorderRadius.circular(20.0), color: Colors.lightBlue.withOpacity(0.3), ), child: Padding( padding: const EdgeInsets.all(15.0), child: Icon(Icons.date_range, color: Colors.lightBlue,), ), ), SizedBox(width: 20.0,), Text("Check in - Check out", style: TextStyle( color: Colors.grey, fontSize: 20.0, ),) ], ), SizedBox(height: 10.0,), Divider( thickness: 1.0, ), SizedBox(height: 10.0,), Row( children: <Widget>[ Container( decoration : BoxDecoration( borderRadius: BorderRadius.circular(20.0), color: Colors.lightBlue.withOpacity(0.3), ), child: Padding( padding: const EdgeInsets.all(15.0), child: Icon(Icons.person, color: Colors.lightBlue,), ), ), SizedBox(width: 20.0,), Text("1 Adult, 0 Children, 1 Room", style: TextStyle( color: Colors.grey, fontSize: 20.0, ),) ], ), SizedBox(height: 10.0,), Divider( thickness: 1.0, ), SizedBox(height: 10.0,), Container( width: 360.0, decoration: BoxDecoration( color: Colors.lightBlue, borderRadius: BorderRadius.circular(20.0) ), child: Center( child: Padding( padding: const EdgeInsets.only(top: 20.0, bottom: 20.0), child: Text("Search", style: TextStyle( color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold ), ), ), ), ) ], ), ), ), SizedBox(height: 25.0,), Padding( padding: const EdgeInsets.only(left:25.0, right: 25.0), child: Text("Popular places", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontFamily: 'Nunito', letterSpacing: 0.5, fontSize: 24.0 ),), ), SizedBox(height: 20.0,), Padding( padding: const EdgeInsets.only(left:25.0, right: 25.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Image.asset("assets/amsterdam.png", height: 100.0, width: 100.0,), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("Amsterdam", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Nunito' ), ), SizedBox(height: 5.0,), Text("12,203 properties", style: TextStyle( color: Colors.grey, fontWeight: FontWeight.bold ),) ], ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(20.0), color: Colors.grey.withOpacity(0.4), ), child: Padding( padding: const EdgeInsets.all(15.0), child: Icon(Icons.arrow_forward, color: Colors.black,), ), ) ], ), ), SizedBox(height: 20.0,), Padding( padding: const EdgeInsets.only(left:25.0, right: 25.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Image.asset("assets/paris.png", height: 100.0, width: 100.0,), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text("Eiffel Tower, Paris", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Nunito' ), ), SizedBox(height: 5.0,), Text("15, 475 properties", style: TextStyle( color: Colors.grey, fontWeight: FontWeight.bold ),) ], ), InkWell( onTap: (){ Navigator.push( context, MaterialPageRoute(builder: (context) => Second()), ); }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(20.0), color: Colors.grey.withOpacity(0.4), ), child: Padding( padding: const EdgeInsets.all(15.0), child: Icon(Icons.arrow_forward, color: Colors.black,), ), ), ) ], ), ), SizedBox(height: 20.0,), ], ), ), ); } }
0
mirrored_repositories/Flutter_Travel_app
mirrored_repositories/Flutter_Travel_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:channel_travel_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/flutter-ui/profile_ui
mirrored_repositories/flutter-ui/profile_ui/lib/main.dart
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', home: Scaffold( body: ProfileUI(), ), ); } } class ProfileUI extends StatelessWidget { @override Widget build(BuildContext context) { return Column( children: <Widget>[ Stack( overflow: Overflow.visible, alignment: Alignment.center, children: <Widget>[ Image.asset( 'images/birds.jpg', fit: BoxFit.cover, height: MediaQuery.of(context).size.height / 3, ), Positioned( bottom: -50.0, child: CircleAvatar( radius: 80, backgroundColor: Colors.white, backgroundImage: AssetImage('images/avatar.jpg'), )) ], ), SizedBox( height: 60, ), Center( child: Column( children: <Widget>[ Text( 'Iron Man', style: TextStyle(fontWeight: FontWeight.w400), ), Text( 'The one and only Tony Stark', style: TextStyle(fontWeight: FontWeight.w200), ), Padding( padding: EdgeInsets.all(24.0), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Icon(Icons.contact_mail), Text('Call Me Ladies !'), ], ), ), ], ), ), Text( 'About me', style: TextStyle(fontWeight: FontWeight.bold), ), Text( 'Hi my name is Tony Stark and I am Iron Man. What you want more? Well, I am also genius, billionare, playboy and philantropist', style: TextStyle(fontStyle: FontStyle.italic, color: Colors.blueGrey), ), ], ); } }
0
mirrored_repositories/flutter-ui/profile_ui
mirrored_repositories/flutter-ui/profile_ui/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:profile_ui/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/flutter-ui/ui_3
mirrored_repositories/flutter-ui/ui_3/lib/main.dart
import 'package:flutter/material.dart'; import './screens/indexPage.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter UI app', home: IndexPage(), ); } }
0