repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/view
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/view/widgets/chat_widget.dart
import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:chat_gpt/utils/app_colors.dart'; import 'package:chat_gpt/view/widgets/custom_text_widget.dart'; import 'package:flutter/material.dart'; class ChatWidget extends StatelessWidget { const ChatWidget({super.key, required this.msg, required this.index}); final String msg; final int index; @override Widget build(BuildContext context) { return Column( children: [ Container( color: index == 0 ? AppColors.backgroundColor : AppColors.cardColor, padding: const EdgeInsets.all(8), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( index == 0 ? "assets/images/hacker.png" : "assets/images/chat_logo.png", height: 30, width: 30, ), const SizedBox(width: 10), Expanded( child: index == 0 ? CustomTextWidget(label: msg) : AnimatedTextKit( repeatForever: false, isRepeatingAnimation: false, displayFullTextOnTap: true, totalRepeatCount: 1, animatedTexts: [ TyperAnimatedText( msg.trim(), textStyle: const TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500, ), ) ])), index == 0 ? const SizedBox.shrink() : Row( mainAxisAlignment: MainAxisAlignment.end, mainAxisSize: MainAxisSize.min, children: const [ Icon( Icons.thumb_up_alt_outlined, color: Colors.white, ), SizedBox(width: 5), Icon( Icons.thumb_down_outlined, color: Colors.white, ) ], ) ], ), ) ], ); } }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/view
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/view/widgets/drop_down.dart
import 'package:chat_gpt/models/openApiModel_model.dart'; import 'package:chat_gpt/provider/models_provider.dart'; import 'package:chat_gpt/utils/app_colors.dart'; import 'package:chat_gpt/view/widgets/custom_text_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class CustomDropDownButton extends StatefulWidget { const CustomDropDownButton({super.key}); @override State<CustomDropDownButton> createState() => _CustomDropDownButtonState(); } class _CustomDropDownButtonState extends State<CustomDropDownButton> { @override Widget build(BuildContext context) { final provider = Provider.of<ModelProvider>(context, listen: false); String? currentModel = provider.currentModel; return FutureBuilder<List<OpenApiModel>>( future: provider.getAllModels(), builder: (context, snapshot) { if (snapshot.hasError) { return SizedBox( child: Text(snapshot.error.toString()), ); } return snapshot.data == null || snapshot.data!.isEmpty ? const Center( child: CircularProgressIndicator( color: Colors.white, ), ) : FittedBox( child: DropdownButton( dropdownColor: AppColors.backgroundColor, iconEnabledColor: Colors.white, items: List<DropdownMenuItem<String>>.generate( snapshot.data!.length, (index) => DropdownMenuItem( value: snapshot.data![index].id, child: CustomTextWidget( label: snapshot.data![index].id, fontSize: 15, ), ), ), value: currentModel, onChanged: (value) { setState(() { currentModel = value.toString(); }); provider.setCurrentModel(value.toString()); }, ), ); }); } }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/models/openApiModel_model.dart
class OpenApiModel { final String id; final int created; final String root; OpenApiModel({ required this.id, required this.root, required this.created, }); factory OpenApiModel.fromJson(Map<String, dynamic> json) => OpenApiModel( id: json["id"], root: json["root"], created: json["created"], ); static List<OpenApiModel> modelsFromSnapshot(List modelSnapshot) { return modelSnapshot.map((data) => OpenApiModel.fromJson(data)).toList(); } }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/models/chat_model.dart
class ChatModel { final String msg; final int chatIndex; ChatModel({required this.msg, required this.chatIndex}); factory ChatModel.fromJson(Map<String, dynamic> json) => ChatModel( msg: json["msg"], chatIndex: json["chatIndex"], ); }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/provider/chat_provider.dart
import 'package:flutter/cupertino.dart'; import '../models/chat_model.dart'; import '../services/api_services.dart'; class ChatProvider with ChangeNotifier { List<ChatModel> chatList = []; List<ChatModel> get getchatList => chatList; void addUserMessage({required String msg}) { chatList.add(ChatModel(msg: msg, chatIndex: 0)); notifyListeners(); } Future<void> botMessage( {required String msg, required String modelID}) async { chatList.addAll(await ApiServices.sendMessage( msg: msg, modelId: modelID, )); notifyListeners(); } }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/provider/models_provider.dart
import 'package:chat_gpt/models/openApiModel_model.dart'; import 'package:chat_gpt/services/api_services.dart'; import 'package:flutter/cupertino.dart'; class ModelProvider with ChangeNotifier { String currentModel = "text-davinci-001"; String get getCurrentModel => currentModel; List<OpenApiModel> modelList = []; List<OpenApiModel> get getModelList => modelList; void setCurrentModel(String model) { currentModel = model; notifyListeners(); } Future<List<OpenApiModel>> getAllModels() async { modelList = await ApiServices.getModel(); return modelList; } }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/utils/app_colors.dart
import 'dart:ui'; class AppColors { static const backgroundColor = Color(0xff343541); static const cardColor = Color(0xff444654); }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/utils/test_data.dart
import 'package:chat_gpt/view/widgets/custom_text_widget.dart'; import 'package:flutter/material.dart'; // List<String> models = [ // 'Model1', // 'Model2', // 'Model3', // 'Model4', // 'Model5', // 'Model6', // ]; // List<DropdownMenuItem<String>>? get getModelsItem { // List<DropdownMenuItem<String>>? modelsItems = // List<DropdownMenuItem<String>>.generate( // models.length, // (index) => DropdownMenuItem( // value: models[index], // child: CustomTextWidget( // label: models[index], // fontSize: 15, // ), // ), // ); // return modelsItems; // } // final chatMessages = [ // { // "msg": "Hello who are you?", // "chatIndex": 0, // }, // { // "msg": // "Hello, I am ChatGPT, a large language model developed by OpenAI. I am here to assist you with any information or questions you may have. How can I help you today?", // "chatIndex": 1, // }, // { // "msg": "What is flutter?", // "chatIndex": 0, // }, // { // "msg": // "Flutter is an open-source mobile application development framework created by Google. It is used to develop applications for Android, iOS, Linux, Mac, Windows, and the web. Flutter uses the Dart programming language and allows for the creation of high-performance, visually attractive, and responsive apps. It also has a growing and supportive community, and offers many customizable widgets for building beautiful and responsive user interfaces.", // "chatIndex": 1, // }, // { // "msg": "Okay thanks", // "chatIndex": 0, // }, // { // "msg": // "You're welcome! Let me know if you have any other questions or if there's anything else I can help you with.", // "chatIndex": 1, // }, // ];
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/services/api_services.dart
import 'dart:convert'; import 'dart:developer'; import 'dart:io'; import 'package:chat_gpt/models/chat_model.dart'; import 'package:chat_gpt/models/openApiModel_model.dart'; import 'package:http/http.dart' as http; const String _BASE_URL = "https://api.openai.com/v1"; const String _Api_key = "YOUR API KEY"; class ApiServices { static Future<List<OpenApiModel>> getModel() async { try { var response = await http.get( Uri.parse("$_BASE_URL/models"), headers: {"Authorization": "Bearer $_Api_key"}, ); Map jsonResponse = jsonDecode(response.body); if (jsonResponse["error"] != null) { throw HttpException(jsonResponse["error"]["message"]); } List temp = []; for (var value in jsonResponse["data"]) { temp.add(value); //log("model: $value"); } return OpenApiModel.modelsFromSnapshot(temp); } catch (e) { log(e.toString()); rethrow; } } static Future<List<ChatModel>> sendMessage( {required String msg, required String modelId}) async { try { var response = await http.post(Uri.parse("$_BASE_URL/completions"), headers: { "Content-Type": "application/json", "Authorization": "Bearer $_Api_key" }, body: jsonEncode({"model": modelId, "prompt": msg, "max_tokens": 100})); Map jsonResponse = jsonDecode(response.body); if (jsonResponse["error"] != null) { throw HttpException(jsonResponse["error"]["message"]); } List<ChatModel> chatList = []; if (jsonResponse["choices"].length > 0) { //log("Message: ${jsonResponse["choices"][0]["text"]}"); chatList = List.generate( jsonResponse["choices"].length, (index) => ChatModel( msg: jsonResponse["choices"][index]["text"], chatIndex: 1, ), ); } return chatList; } catch (e) { log(e.toString()); rethrow; } } }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib
mirrored_repositories/OpenAI-ChatGPT-Flutter/lib/services/services.dart
import 'package:chat_gpt/view/widgets/drop_down.dart'; import 'package:flutter/material.dart'; import '../utils/app_colors.dart'; import '../view/widgets/custom_text_widget.dart'; class Services { static Future<void> showBottomSheet({required context}) async { await showModalBottomSheet( backgroundColor: AppColors.backgroundColor, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(15))), context: context, builder: (context) { return Padding( padding: const EdgeInsets.all(16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: const [ Flexible( child: CustomTextWidget( label: "Choose Model:", fontSize: 16, ), ), Flexible(flex: 2, child: CustomDropDownButton()) ], ), ); }, ); } }
0
mirrored_repositories/OpenAI-ChatGPT-Flutter
mirrored_repositories/OpenAI-ChatGPT-Flutter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility 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:chat_gpt/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/Worldtime
mirrored_repositories/Worldtime/lib/main.dart
import 'package:flutter/material.dart'; import 'package:worldtimeapp/pages/choose_location.dart'; import 'package:worldtimeapp/pages/home.dart'; import 'package:worldtimeapp/pages/loading.dart'; void main() { runApp(MaterialApp( initialRoute: '/', routes: { '/': (context)=> Loading(), '/home':(context)=>Home(), '/location': (context)=> ChooseLocation(), }, )); }
0
mirrored_repositories/Worldtime/lib
mirrored_repositories/Worldtime/lib/pages/loading.dart
import 'package:flutter/material.dart'; import 'package:http/http.dart'; import 'dart:convert'; import 'package:worldtimeapp/services/world_time.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; class Loading extends StatefulWidget { @override _LoadingState createState() => _LoadingState(); } class _LoadingState extends State<Loading> { void setupWorldTime() async { WorldTime instance = WorldTime( location: 'Kolkata', flag: 'india.png', url: 'Asia/Kolkata'); await instance.getTime(); Navigator.pushReplacementNamed(context, '/home', arguments: { 'location': instance.location, 'flag': instance.flag, 'time': instance.time, 'isDaytime':instance.isDaytime, }); } @override void initState() { super.initState(); setupWorldTime(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.blue[900], body: Center( child: SpinKitFoldingCube( color: Colors.white, size: 80.0, ), ), ); } }
0
mirrored_repositories/Worldtime/lib
mirrored_repositories/Worldtime/lib/pages/choose_location.dart
import 'package:flutter/material.dart'; import 'package:worldtimeapp/services/world_time.dart'; class ChooseLocation extends StatefulWidget { @override _ChooseLocationState createState() => _ChooseLocationState(); } class _ChooseLocationState extends State<ChooseLocation> { List<WorldTime> locations = [ WorldTime(url: 'Europe/London', location: 'London', flag: 'uk.png'), WorldTime(url: 'Asia/Jerusalem', location: 'Jerusalem', flag: 'israel2.png'), WorldTime(url: 'America/Chicago', location: 'Chicago', flag: 'usa.png'), WorldTime(url: 'Europe/Berlin', location: 'Berlin', flag: 'germany.png'), WorldTime(url: 'Europe/Lisbon', location: 'Lisbon', flag: 'portugal.png'), WorldTime(url: 'Europe/Berlin', location: 'Athens', flag: 'greece.png'), WorldTime(url: 'Africa/Cairo', location: 'Cairo', flag: 'egypt.png'), WorldTime(url: 'Africa/Nairobi', location: 'Nairobi', flag: 'kenya.png'), WorldTime(url: 'America/New_York', location: 'New York', flag: 'usa.png'), WorldTime(url: 'Asia/Seoul', location: 'Seoul', flag: 'south_korea.png'), WorldTime(url: 'Asia/Jakarta', location: 'Jakarta', flag: 'indonesia.png'), WorldTime(url: 'Europe/Madrid', location: 'Madrid', flag: 'spain.png'), ]; void updateTime(index) async { WorldTime instance = locations[index]; await instance.getTime(); //navigate to home screen Navigator.pop(context, { 'location': instance.location, 'flag': instance.flag, 'time': instance.time, 'isDaytime':instance.isDaytime, }); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.grey[200], appBar: AppBar( backgroundColor: Colors.blue[900], title: Text('Choose a Location'), centerTitle: true, elevation: 0, ), body: ListView.builder( itemCount: locations.length, itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.symmetric(vertical: 1.0, horizontal: 4.0), child: Card( child: ListTile( onTap: () { updateTime(index); print(locations[index].location); }, title: Text(locations[index].location), leading: CircleAvatar( backgroundImage: AssetImage('assets/${locations[index].flag}'), ), ), ), ); }), ); } }
0
mirrored_repositories/Worldtime/lib
mirrored_repositories/Worldtime/lib/pages/home.dart
import 'package:flutter/material.dart'; class Home extends StatefulWidget { @override _HomeState createState() => _HomeState(); } class _HomeState extends State<Home> { Map data = {}; @override Widget build(BuildContext context) { data = data.isNotEmpty ? data : ModalRoute.of(context)!.settings.arguments as Map; print(data); //set background String bgImage = data['isDaytime'] ? 'day.png' : 'night.png'; var bgColor = data['isDaytime'] ? Colors.blue : Colors.indigo[700]; return Scaffold( appBar: AppBar( backgroundColor: Colors.black, title: Text('WORLD TIME APP', style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, ),) ), backgroundColor: bgColor, body: SafeArea( child: Container( decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/$bgImage'), fit: BoxFit.cover, )), child: Padding( padding: const EdgeInsets.fromLTRB(0, 120.0, 0, 0), child: Column( children: <Widget>[ FlatButton.icon( onPressed: () async { dynamic result = await Navigator.pushNamed(context, '/location'); setState(() { data = { 'time': result['time'], 'location': result['location'], 'isDaytime': result['isDaytime'], 'flag': result['flag'], }; }); }, icon: Icon( Icons.edit_location, color: Colors.grey[300], ), label: Text('Edit Location', style: TextStyle( color: Colors.grey[300], ))), SizedBox(height: 20.0), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( data['location'], style: TextStyle( fontSize: 30.0, letterSpacing: 2.0, fontWeight: FontWeight.bold, color: Colors.white), ) ], ), SizedBox(height: 10.0), Text( data['time'], style: TextStyle(fontSize: 70.0), ), SizedBox(height: 100), Padding( padding: const EdgeInsets.all(8.0), child: Card( elevation: 80, shadowColor: Colors.black, color: Colors.orangeAccent, child: Padding( padding: EdgeInsets.all(15.0), child: Row( children: [ CircleAvatar( backgroundImage: AssetImage( 'assets/photo.jpg', ), radius: 60, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(' Hi folks,', style: TextStyle( color: Colors.deepPurple, fontSize: 15.0, fontWeight: FontWeight.bold)), Text(' this is Saptarshi Mandal', style: TextStyle( color: Colors.deepPurple, fontSize: 18.0, fontWeight: FontWeight.bold)), Padding( padding: const EdgeInsets.fromLTRB(10.0,0,0,0), child: Row( children: [ Icon( Icons.mail, color: Colors.black, ), Text('saptarshimandal125@gmail.com', style: TextStyle( color: Colors.red, fontSize: 12.0, fontWeight: FontWeight.bold)), ], ), ), Padding( padding: const EdgeInsets.all(8.0), child: Text(' Click the Edit Location', style: TextStyle( color: Colors.blue[900], fontSize: 15.0, fontWeight: FontWeight.bold)), ) ], ) ], ), ), ), ) ], ), ), ))); } }
0
mirrored_repositories/Worldtime/lib
mirrored_repositories/Worldtime/lib/services/world_time.dart
import 'package:flutter/material.dart'; import 'package:http/http.dart'; import 'dart:convert'; import 'package:intl/intl.dart'; class WorldTime { String location = ''; // location for the UI String time = ''; // the time in that location String flag = ''; //url for assets file icon String url = ''; // location url for api endpoint bool isDaytime=true; //true or false day or night WorldTime({this.location = '', this.flag = '', this.url = ''}); Future<void> getTime() async { try { Response response = await get(Uri.parse('http://worldtimeapi.org/api/timezone/$url')); Map data = jsonDecode(response.body); //print(data); //get properties from data String datetime = data['datetime']; String offset1 = data['utc_offset'].substring(0, 3); String offset2 = data['utc_offset'].substring(4, 6); DateTime now = DateTime.parse(datetime); now = now.add( Duration(hours: int.parse(offset1), minutes: int.parse(offset2))); //set the time property isDaytime = now.hour >= 6 && now.hour<20 ? true : false; time = DateFormat.jm().format(now); } catch (e) { print('caught error: $e'); time = 'could not get time data'; } } }
0
mirrored_repositories/Worldtime
mirrored_repositories/Worldtime/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:worldtimeapp/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-firestore-chat
mirrored_repositories/flutter-firestore-chat/lib/manager.dart
import 'package:chat/screens/chat_screen.dart'; import 'package:flutter/material.dart'; import 'screens/login_screen.dart'; import 'package:chat/models/auth.dart'; enum authStatus { signedout, signedIn } class Manager extends StatefulWidget { final AuthImplementation auth; Manager({ this.auth, }); @override _ManagerState createState() => _ManagerState(); } class _ManagerState extends State<Manager> { authStatus _authStatus = authStatus.signedout; @override void initState() { super.initState(); widget.auth.getCurrentUserId().then((firebaseUserId) { setState(() { _authStatus = firebaseUserId == null ? authStatus.signedout : authStatus.signedIn; }); }); } void _signedIn() { setState(() { _authStatus = authStatus.signedIn; }); } void _signedOut() { setState(() { _authStatus = authStatus.signedout; }); } @override Widget build(BuildContext context) { switch (_authStatus) { case authStatus.signedout: return LoginScreen( auth: widget.auth, signedIn: _signedIn, ); case authStatus.signedIn: return ChatScreen( auth: widget.auth, signedOut: _signedOut, ); } return null; } }
0
mirrored_repositories/flutter-firestore-chat
mirrored_repositories/flutter-firestore-chat/lib/main.dart
import 'package:flutter/material.dart'; import 'manager.dart'; import 'package:chat/models/auth.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', debugShowCheckedModeBanner: false, theme: ThemeData( primaryColor: Colors.black, visualDensity: VisualDensity.adaptivePlatformDensity, ), home: Manager( auth: Auth(), ), ); } }
0
mirrored_repositories/flutter-firestore-chat/lib
mirrored_repositories/flutter-firestore-chat/lib/utilities/constants.dart
import 'package:flutter/material.dart'; Color royalBlue = Color(0xff6f6ed6), cornFlowerBlue = Color(0xff7d7cda), buff = Color(0xfff9dd7a), antiFlashWhite = Color(0xffebeef3);
0
mirrored_repositories/flutter-firestore-chat/lib
mirrored_repositories/flutter-firestore-chat/lib/models/auth.dart
import 'package:firebase_auth/firebase_auth.dart'; abstract class AuthImplementation { Future<String> signIn(String email, String password); Future<String> signUp(String email, String password); Future<void> signOut(); Future<String> getCurrentUserId(); Future<String> getCurrentUserEmail(); } class Auth implements AuthImplementation { final FirebaseAuth _firebaseAuth = FirebaseAuth.instance; Future<String> signIn(String email, String password) async { AuthResult authResult = await _firebaseAuth.signInWithEmailAndPassword( email: email, password: password); return authResult.toString(); } Future<String> signUp(String email, String password) async { AuthResult authResult = await _firebaseAuth.createUserWithEmailAndPassword( email: email, password: password); return authResult.toString(); } Future<void> signOut() async { _firebaseAuth.signOut(); } Future<String> getCurrentUserId() async { FirebaseUser user = await _firebaseAuth.currentUser(); return user.uid; } Future<String> getCurrentUserEmail() async { FirebaseUser user = await _firebaseAuth.currentUser(); return user.email; } }
0
mirrored_repositories/flutter-firestore-chat/lib
mirrored_repositories/flutter-firestore-chat/lib/models/dialogbox.dart
import 'package:chat/utilities/constants.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class DialogBox { information(BuildContext context, String title, String desc) { return showDialog( context: context, barrierDismissible: true, builder: (BuildContext context) { return AlertDialog( backgroundColor: cornFlowerBlue, title: Text( title, style: TextStyle( color: Colors.white, fontFamily: 'Spartan', fontSize: 30, fontWeight: FontWeight.bold), ), content: SingleChildScrollView( child: ListBody( children: <Widget>[ Text( desc, style: TextStyle( color: antiFlashWhite, fontFamily: 'Poppins', fontSize: 12, ), ), ], ), ), actions: <Widget>[ FlatButton( onPressed: () { return Navigator.pop(context); }, child: FaIcon( FontAwesomeIcons.checkCircle, color: Colors.white, ), ), ], ); }); } }
0
mirrored_repositories/flutter-firestore-chat/lib
mirrored_repositories/flutter-firestore-chat/lib/models/message.dart
import 'package:chat/utilities/constants.dart'; import 'package:flutter/material.dart'; class Message extends StatelessWidget { final String user, text; final bool mine; final timestamp; Message({Key key, this.user, this.text, this.mine, this.timestamp}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5), child: Column( crossAxisAlignment: mine ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: <Widget>[ Text( user, style: TextStyle( color: mine ? Colors.black : royalBlue, fontSize: 13, fontFamily: 'Montserrat', ), ), Material( color: mine ? royalBlue : Colors.white, borderRadius: BorderRadius.circular(15.0), elevation: 5.0, child: Container( padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0), child: Text( text, style: TextStyle( color: mine ? Colors.white : Colors.black, fontSize: 15, fontFamily: 'Poppins', ), ), ), ), ], ), ); } }
0
mirrored_repositories/flutter-firestore-chat/lib
mirrored_repositories/flutter-firestore-chat/lib/screens/chat_screen.dart
import 'package:chat/utilities/constants.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:chat/models/auth.dart'; import 'package:chat/models/message.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ChatScreen extends StatefulWidget { final AuthImplementation auth; final VoidCallback signedOut; ChatScreen({ this.auth, this.signedOut, }); @override _ChatScreenState createState() => _ChatScreenState(); } class _ChatScreenState extends State<ChatScreen> { final Firestore _firestore = Firestore.instance; TextEditingController messageController = TextEditingController(); ScrollController scrollController = ScrollController(); String userName; @override void initState() { super.initState(); widget.auth.getCurrentUserEmail().then((email) { setState(() { final String userEmail = email; final endIndex = userEmail.indexOf("@"); userName = userEmail.substring(0, endIndex); }); }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( "Chat", style: TextStyle( fontSize: 35, color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Spartan', letterSpacing: 1.5), ), backgroundColor: Colors.white, actions: <Widget>[ IconButton( icon: FaIcon(FontAwesomeIcons.signOutAlt), color: Colors.black, onPressed: logOut), ], ), backgroundColor: antiFlashWhite, body: Column( children: <Widget>[ Expanded( child: Container( //margin: EdgeInsets.symmetric(horizontal: 5), child: StreamBuilder<QuerySnapshot>( stream: _firestore .collection("messages") .orderBy( "timestamp", ) .snapshots(), builder: (context, snapshot) { if (!snapshot.hasData) return Center( child: CircularProgressIndicator( backgroundColor: Colors.blue, ), ); List<DocumentSnapshot> docs = snapshot.data.documents; List<Widget> messages = docs .map((doc) => Message( user: doc.data['user'], text: doc.data['text'], timestamp: doc.data['timestamp'], mine: userName == doc.data['user'], )) .toList(); return ListView( controller: scrollController, children: messages, ); }), ), ), Container( color: Colors.white, child: Row( children: <Widget>[ Expanded( child: Padding( padding: const EdgeInsets.all(10), child: TextField( style: TextStyle( fontFamily: 'Poppins', fontSize: 15, ), onSubmitted: (value) => sendChat(), controller: messageController, cursorColor: cornFlowerBlue, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(20)), filled: true, fillColor: antiFlashWhite, hintText: "Type a message", hintStyle: TextStyle(fontFamily: 'Montserrat', fontSize: 12), ), ), ), ), IconButton( icon: FaIcon( FontAwesomeIcons.paperPlane, color: Colors.black, ), onPressed: sendChat, ), ], ), ), ], ), ); } void logOut() async { try { await widget.auth.signOut(); widget.signedOut(); } catch (e) { print("error :" + e.toString()); } } Future<void> sendChat() async { if (messageController.text.length > 0) { await _firestore.collection("messages").add({ 'user': userName, 'text': messageController.text, 'timestamp': FieldValue.serverTimestamp(), }); messageController.clear(); scrollController.animateTo(scrollController.position.maxScrollExtent, duration: Duration(milliseconds: 300), curve: Curves.easeOut); } } }
0
mirrored_repositories/flutter-firestore-chat/lib
mirrored_repositories/flutter-firestore-chat/lib/screens/login_screen.dart
import 'package:chat/utilities/constants.dart'; import 'package:flutter/material.dart'; import 'package:chat/models/auth.dart'; import 'package:chat/models/dialogbox.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; enum FormType { login, register } class LoginScreen extends StatefulWidget { final AuthImplementation auth; final VoidCallback signedIn; LoginScreen({ this.auth, this.signedIn, }); @override _LoginScreenState createState() => _LoginScreenState(); } class _LoginScreenState extends State<LoginScreen> { DialogBox dialogBox = DialogBox(); final formKey = GlobalKey<FormState>(); FormType _formType = FormType.login; String _email = ""; String _password = ""; void submitForm() async { final form = formKey.currentState; if (form.validate()) { form.save(); try { if (_formType == FormType.login) { String authResult = await widget.auth.signIn(_email, _password); dialogBox.information( context, "Congratulations", "You are logged in successfully"); print(authResult); } else { String authResult = await widget.auth.signUp(_email, _password); dialogBox.information(context, "Congratulations", "Your account has been created successfully"); print(authResult); } widget.signedIn(); } catch (e) { dialogBox.information(context, "Error", e.toString()); } } } void switchForm(FormType formType) { formKey.currentState.reset(); setState(() { _formType = formType; }); } @override Widget build(BuildContext context) { return Material( color: royalBlue, child: Container( margin: EdgeInsets.all(25), child: Form( key: formKey, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ FaIcon( FontAwesomeIcons.fireAlt, size: 120, color: buff, ), Text( "Fire Chat.", style: TextStyle( fontFamily: "Spartan", fontSize: 50, color: Colors.white, fontWeight: FontWeight.bold), ), SizedBox( height: 20, ), Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12.0), boxShadow: [ BoxShadow( color: Colors.black12, offset: Offset(0.0, 15.0), blurRadius: 15.0), BoxShadow( color: Colors.black12, offset: Offset(0.0, -10.0), blurRadius: 10.0), ]), child: Padding( padding: EdgeInsets.only(left: 20, right: 20, bottom: 25), child: Column( children: screenInputs(), ), ), ), Container( child: Column( children: screenButtons(), ), ), ], ), ), ), ); } List<Widget> screenInputs() { return [ TextFormField( style: TextStyle( color: Colors.black, fontFamily: 'Spartan', fontSize: 20, fontWeight: FontWeight.bold), decoration: InputDecoration( labelText: 'Email', labelStyle: TextStyle( color: Colors.grey[700], fontFamily: 'Montserrat', fontSize: 14, ), ), validator: (value) { return value.isEmpty ? 'Email is required' : null; }, onSaved: (value) { return _email = value; }, ), SizedBox( height: 10, ), TextFormField( style: TextStyle( color: Colors.black, fontFamily: 'Spartan', fontSize: 20, fontWeight: FontWeight.bold), decoration: InputDecoration( labelText: 'Password', labelStyle: TextStyle( color: Colors.grey[700], fontFamily: 'Montserrat', fontSize: 14, ), ), obscureText: true, validator: (value) { return value.isEmpty ? 'Password is required' : null; }, onSaved: (value) { return _password = value; }, ), ]; } List<Widget> screenButtons() { if (_formType == FormType.login) { return [ SizedBox( height: 20, ), InkWell( onTap: submitForm, child: Container( width: 100, decoration: BoxDecoration( color: cornFlowerBlue, borderRadius: BorderRadius.circular(6.0), ), child: Center( child: Padding( padding: EdgeInsets.symmetric(vertical: 10), child: Text( "LOGIN", style: TextStyle( fontFamily: 'Spartan', color: Colors.white, fontWeight: FontWeight.bold, letterSpacing: 1.5), ), ), ), ), ), FlatButton( child: Text( "Don't have an account? Register", style: TextStyle( color: antiFlashWhite, fontFamily: 'Poppins', fontSize: 12), ), onPressed: () { switchForm(FormType.register); }, ) ]; } else { return [ SizedBox( height: 20, ), InkWell( onTap: submitForm, child: Container( width: 100, decoration: BoxDecoration( color: cornFlowerBlue, borderRadius: BorderRadius.circular(6.0), ), child: Center( child: Padding( padding: EdgeInsets.symmetric(vertical: 10), child: Text( "REGISTER", style: TextStyle( fontFamily: 'Spartan', color: Colors.white, fontWeight: FontWeight.bold, letterSpacing: 1.5), ), ), ), ), ), FlatButton( child: Text( "Don't have an account? Register", style: TextStyle( color: antiFlashWhite, fontFamily: 'Poppins', fontSize: 12), ), onPressed: () { switchForm(FormType.login); }, ) ]; } } }
0
mirrored_repositories/flutter-firestore-chat
mirrored_repositories/flutter-firestore-chat/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:chat/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/chatting-app-flutter
mirrored_repositories/chatting-app-flutter/lib/main.dart
import "package:flutter/material.dart"; import 'src/WhatsApp.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: "WhatsApp", theme:ThemeData( primaryColor: Color(0xFF075E54), accentColor: Color(0xFF128C7E) ), home: WhatsApp(), ); } }
0
mirrored_repositories/chatting-app-flutter/lib
mirrored_repositories/chatting-app-flutter/lib/src/WhatsApp.dart
import 'package:flutter/material.dart'; import 'portion/Callportion.dart'; import 'portion/CameraPortion.dart'; import 'portion/ChatPortion.dart'; import 'portion/StatusPortion.dart'; class WhatsApp extends StatefulWidget { @override _WhatsAppState createState() => _WhatsAppState(); } class _WhatsAppState extends State<WhatsApp> with SingleTickerProviderStateMixin{ TabController _tabController; @override void initState() { super.initState(); _tabController=new TabController(initialIndex: 1,vsync: this,length: 4); } Widget build(BuildContext context) { return Scaffold( appBar: AppBar( elevation: 0.7, title: Text("WhatsApp"), actions: <Widget>[ IconButton( icon:Icon(Icons.search), onPressed: (){}, ), Padding( padding: EdgeInsets.symmetric(horizontal: 15.0), ), IconButton( icon:Icon(Icons.more_vert), onPressed: (){}, ), Padding( padding: EdgeInsets.only(right: 20.0), ), ], bottom: TabBar( controller: _tabController, indicatorColor: Colors.white, tabs: <Widget>[ Tab(icon: Icon(Icons.camera_alt),), Tab(text: "CHAT"), Tab(text: "STATUS",), Tab(text: "CALL",) ], ), ), body: TabBarView( controller: _tabController, children: <Widget>[ CameraPortion(), ChatPortion(), StatusPortion(), CallPortion(), ], ), ); } }
0
mirrored_repositories/chatting-app-flutter/lib/src
mirrored_repositories/chatting-app-flutter/lib/src/portion/ChatPortion.dart
import 'package:flutter/material.dart'; class ChatPortion extends StatefulWidget { @override _ChatPortionState createState() => _ChatPortionState(); } class _ChatPortionState extends State<ChatPortion> { @override Widget build(BuildContext context) { return Text("chat"); } }
0
mirrored_repositories/chatting-app-flutter/lib/src
mirrored_repositories/chatting-app-flutter/lib/src/portion/Callportion.dart
import 'package:flutter/material.dart'; class CallPortion extends StatefulWidget { @override _CallPortionState createState() => _CallPortionState(); } class _CallPortionState extends State<CallPortion> { @override Widget build(BuildContext context) { return Text("Call"); } }
0
mirrored_repositories/chatting-app-flutter/lib/src
mirrored_repositories/chatting-app-flutter/lib/src/portion/CameraPortion.dart
import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; import 'dart:io'; class CameraPortion extends StatefulWidget { @override _CameraPortionState createState() => _CameraPortionState(); } class _CameraPortionState extends State<CameraPortion> { @override Widget build(BuildContext context) { return Scaffold( body: Text("Camera"), ) ; } }
0
mirrored_repositories/chatting-app-flutter/lib/src
mirrored_repositories/chatting-app-flutter/lib/src/portion/StatusPortion.dart
import 'package:flutter/material.dart'; class StatusPortion extends StatefulWidget { @override _StatusPortionState createState() => _StatusPortionState(); } class _StatusPortionState extends State<StatusPortion> { @override Widget build(BuildContext context) { return Text("Status"); } }
0
mirrored_repositories/chatting-app-flutter
mirrored_repositories/chatting-app-flutter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:whatsapp/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/photo-gallery
mirrored_repositories/photo-gallery/lib/main.dart
import 'package:flutter/material.dart'; import 'package:projeto_final/screens/tela_inicial.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Galeria de fotos', theme: ThemeData( primarySwatch: Colors.blue, ), home: TelaInicial(), ); } }
0
mirrored_repositories/photo-gallery/lib
mirrored_repositories/photo-gallery/lib/controllers/repository_foto.dart
import 'package:projeto_final/controllers/banco_de_dados.dart'; import 'package:projeto_final/models/foto.dart'; class Repository { BancoDeDados bancoDeDados = BancoDeDados(); final String sqlSelect = 'SELECT * FROM fotos'; final String sqlInsert = 'INSERT INTO fotos (picture, date, latitude, longitude, titulo, descricao) VALUES (?, ?, ?, ?, ?, ?)'; final String sqlDelete = 'DELETE FROM fotos WHERE id = ?'; final String sqlUpdateDescricao = 'UPDATE fotos SET descricao = ? WHERE id = ?'; Future<List<Foto>> selectAll() async { return await bancoDeDados.db! .rawQuery(sqlSelect) .then((List<Map<String, Object?>> value) { List<Foto> fotos = []; for (Map<String, dynamic> fid in value) { fotos.add(Foto.fromMap(fid)); } return fotos; }); } Future<int> insert(Foto foto) async { return await bancoDeDados.db!.rawInsert(sqlInsert, [ foto.picture, foto.date, foto.latitude, foto.longitude, foto.titulo, foto.descricao ]); } Future<void> updateDescricao(Foto foto) async { await bancoDeDados.db! .rawUpdate(sqlUpdateDescricao, [foto.descricao, foto.id]); return; } Future<void> delete(Foto foto) async { await bancoDeDados.db!.rawDelete(sqlDelete, [foto.id]); return; } Future<void> clearTable() async { await bancoDeDados.db!.delete('fotos'); print('deleted'); return; } }
0
mirrored_repositories/photo-gallery/lib
mirrored_repositories/photo-gallery/lib/controllers/controller.dart
import 'dart:typed_data'; import 'package:flutter/cupertino.dart'; import 'package:image_picker/image_picker.dart'; import 'package:location/location.dart'; import 'package:projeto_final/controllers/repository_foto.dart'; import 'package:projeto_final/models/foto.dart'; class Controller { List<Foto> fotos = []; ImagePicker picker = ImagePicker(); TextEditingController caixaTitulo = TextEditingController(); TextEditingController caixaDescricao = TextEditingController(); Repository repository = Repository(); Future<void> select() async { return await repository.selectAll().then((value) => fotos = value); } Future<int> inserir(Uint8List fotoUint) async { return Location.instance.getLocation().then((location) async { Foto foto = Foto( picture: fotoUint, date: DateTime.now().toString(), latitude: location.latitude, longitude: location.longitude, titulo: caixaTitulo.text, descricao: caixaDescricao.text); caixaTitulo.clear(); caixaDescricao.clear(); return await repository.insert(foto); }); } Future<void> remove(int i) async { Foto foto = fotos[i]; return await repository.delete(foto); } Future getImage() async { var image = await picker.getImage( source: ImageSource.camera, imageQuality: 25, maxHeight: 1024, maxWidth: 1024); if (image != null) { var bytes = await image.readAsBytes(); return bytes; } } Future<void> clearTable() async { await repository.clearTable(); return; } }
0
mirrored_repositories/photo-gallery/lib
mirrored_repositories/photo-gallery/lib/controllers/banco_de_dados.dart
import 'package:sqflite/sqflite.dart'; class BancoDeDados { static BancoDeDados? _instance; Database? db; String onCreateSQL = ''' CREATE TABLE fotos ( id INTEGER PRIMARY KEY AUTOINCREMENT, picture BLOB, date TEXT, latitude REAL, longitude REAL, titulo TEXT, descricao TEXT ); '''; BancoDeDados._privado(); factory BancoDeDados() { return _instance ??= BancoDeDados._privado(); } Future<void> onCreate(Database db, int version) async { await db.execute(onCreateSQL); } Future<void> openDb() async { if (db == null) { return getDatabasesPath().then((value) { String path = value + 'fotos.db'; return openDatabase(path, onCreate: onCreate, version: 1).then((value) { db = value; }); }); } } Future<void> deleteDb() async { return getDatabasesPath().then((value) async { String path = value + 'fotos.db'; return await deleteDatabase(path); }); } }
0
mirrored_repositories/photo-gallery/lib
mirrored_repositories/photo-gallery/lib/models/foto.dart
import 'dart:typed_data'; class Foto { int? id; Uint8List? picture; String? date; double? latitude; double? longitude; String? titulo; String? descricao; Foto( {this.picture, this.date, this.latitude, this.longitude, this.titulo, this.descricao}); Foto.fromMap(Map<String, dynamic> map) { this.id = map['id']; this.picture = map['picture']; this.date = map['date']; this.latitude = map['latitude']; this.longitude = map['longitude']; this.titulo = map['titulo']; this.descricao = map['descricao']; } @override String toString() { return '${date.toString()} - $latitude - $longitude - $titulo - $descricao'; } }
0
mirrored_repositories/photo-gallery/lib
mirrored_repositories/photo-gallery/lib/screens/tela_inicial.dart
import 'package:flutter/material.dart'; import 'package:projeto_final/controllers/banco_de_dados.dart'; import 'package:projeto_final/controllers/controller.dart'; import 'package:projeto_final/screens/tela_cadastro.dart'; import 'package:projeto_final/screens/tela_visualizacao.dart'; class TelaInicial extends StatefulWidget { @override _TelaInicialState createState() => _TelaInicialState(); } class _TelaInicialState extends State<TelaInicial> { bool loading = true; final Controller controller = Controller(); @override void initState() { super.initState(); BancoDeDados db = BancoDeDados(); db.openDb().then((value) { select(); }); } void select() { setState(() { loading = true; }); controller.select().then((value) => { setState(() { loading = false; }) }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Galeria de fotos', ), centerTitle: true, actions: [ IconButton( icon: Icon(Icons.delete), tooltip: 'Apagar todas as imagens', onPressed: () { showDialog( context: context, builder: (context) { return AlertDialog( title: Text( 'Você tem certeza que deseja apagar todas as imagens?'), content: Text('Esta ação é irreversível.'), actions: [ TextButton( onPressed: () { controller.clearTable(); select(); Navigator.pop(context); }, child: Text( 'Apagar', style: TextStyle(color: Colors.red), ), ), TextButton( onPressed: () { Navigator.pop(context); }, child: Text( 'Cancelar', style: TextStyle(color: Colors.green), )), ], ); }); }, ) ], ), floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButton: FloatingActionButton( child: Icon(Icons.camera_alt), tooltip: 'Tirar uma foto', onPressed: () { controller.getImage().then((foto) async { if (foto != null) { await Navigator.of(context) .push(MaterialPageRoute(builder: (context) { return TelaCadastro( foto: foto, controller: controller, ); })); select(); } }); }), body: loading ? Center( child: RefreshProgressIndicator(), ) : RefreshIndicator( onRefresh: () async { select(); }, child: Center( child: controller.fotos.isNotEmpty ? Column( children: [ SizedBox( height: 6, ), Flexible( child: ListView.builder( itemBuilder: (context, i) { return Padding( padding: const EdgeInsets.symmetric( horizontal: 12.0, vertical: 6), child: Container( decoration: BoxDecoration( border: Border.all( width: 2, color: Colors.grey), borderRadius: BorderRadius.all( Radius.circular(10))), child: ListTile( title: Padding( padding: EdgeInsets.fromLTRB(0, 4, 0, 4), child: Text(controller.fotos[i].titulo!), ), subtitle: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Data: ${DateTime.parse(controller.fotos[i].date!).day}' '/${DateTime.parse(controller.fotos[i].date!).month}/${DateTime.parse(controller.fotos[i].date!).year}'), Text( 'Latitude: ${controller.fotos[i].latitude!.toStringAsFixed(4)}'), Text( 'Longitude: ${controller.fotos[i].longitude!.toStringAsFixed(4)}'), ], ), onTap: () async { await Navigator.of(context).push( MaterialPageRoute( builder: (context) { return TelaVisualizacao( i: i, controller: controller, ); })); select(); }, trailing: Image.memory( controller.fotos[i].picture!), ), ), ); }, itemCount: controller.fotos.length, ), ), ], ) : Text('Nenhuma foto para listar.'), ), ), ); } }
0
mirrored_repositories/photo-gallery/lib
mirrored_repositories/photo-gallery/lib/screens/tela_visualizacao.dart
import 'package:flutter/material.dart'; import 'package:projeto_final/controllers/controller.dart'; class TelaVisualizacao extends StatelessWidget { TelaVisualizacao({required this.i, required this.controller, Key? key}) : super(key: key); final Controller controller; final int i; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(controller.fotos[i].titulo!), centerTitle: true, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButton: FloatingActionButton.extended( onPressed: () { controller.remove(i).then((value) { Navigator.of(context).pop(); }); }, label: Text('Excluir'), ), body: SingleChildScrollView( child: controller.fotos[i].picture != null ? Padding( padding: const EdgeInsets.all(12.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( controller.fotos[i].descricao!, textAlign: TextAlign.start, style: TextStyle(fontSize: 16), ), Padding( padding: const EdgeInsets.symmetric(vertical: 12.0), child: Image.memory(controller.fotos[i].picture!), ), ], ), ) : Center( child: RefreshProgressIndicator(), ), ), ); } }
0
mirrored_repositories/photo-gallery/lib
mirrored_repositories/photo-gallery/lib/screens/tela_cadastro.dart
import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:projeto_final/controllers/controller.dart'; class TelaCadastro extends StatefulWidget { TelaCadastro({required this.foto, required this.controller}); final Uint8List foto; final Controller controller; @override _TelaCadastroState createState() => _TelaCadastroState(); } class _TelaCadastroState extends State<TelaCadastro> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( 'Nova Foto', ), centerTitle: true, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButton: FloatingActionButton.extended( onPressed: () async { int fotoId = await widget.controller.inserir(widget.foto); Navigator.of(context).pop(fotoId); }, label: Text('Salvar'), ), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(12.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ widget.foto.isNotEmpty ? Padding( padding: const EdgeInsets.only(bottom: 12.0), child: Image.memory( widget.foto, fit: BoxFit.contain, ), ) : RefreshProgressIndicator(), Text( 'Título:', style: styleTitle(), ), SizedBox( height: 6, ), TextField( controller: widget.controller.caixaTitulo, decoration: styleTextField(), textCapitalization: TextCapitalization.sentences, ), SizedBox( height: 12, ), Text( 'Descrição:', style: styleTitle(), ), SizedBox( height: 6, ), TextField( textCapitalization: TextCapitalization.sentences, controller: widget.controller.caixaDescricao, minLines: 5, maxLines: 7, decoration: styleTextField(), ), SizedBox( height: 70, ), ], ), ), ), ); } TextStyle styleTitle() { return TextStyle(fontWeight: FontWeight.w500, fontSize: 16); } InputDecoration styleTextField() { return InputDecoration( border: const OutlineInputBorder(), ); } }
0
mirrored_repositories/photo-gallery
mirrored_repositories/photo-gallery/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:projeto_final/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/sort_it
mirrored_repositories/sort_it/lib/main.dart
import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_navigation/src/root/get_material_app.dart'; import 'package:sort_it/routes/navigation_route.dart'; import 'package:sort_it/src/screens/home/home.dart'; import 'package:sort_it/src/screens/sign_in/sign_in.dart'; import 'package:sort_it/src/screens/sign_up/sign_up.dart'; import 'package:sort_it/src/screens/welcome/welcome.dart'; import 'constant/constant.dart' as constant; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MediaQuery( data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window), child: ScreenUtilInit( designSize: Size(500, 500), minTextAdapt: true, splitScreenMode: true, builder: () => GetMaterialApp( debugShowCheckedModeBanner: false, title: 'Sort It', theme: ThemeData( primarySwatch: Colors.blue, textTheme: TextTheme( button: TextStyle(fontSize: 45.sp), headline1: constant.headline1, headline2: constant.headline2, headline3: constant.headline3, headline4: constant.headline4, headline5: constant.headline5, ), ), routes: routes, initialRoute: Home.routeName, ), ), ); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/routes/navigation_route.dart
import 'package:flutter/cupertino.dart'; import 'package:sort_it/src/screens/choice/choice.dart'; import 'package:sort_it/src/screens/complete/complete_profile.dart'; import 'package:sort_it/src/screens/editprofile/editprofile.dart'; import 'package:sort_it/src/screens/home/home.dart'; import 'package:sort_it/src/screens/map/map.dart'; import 'package:sort_it/src/screens/permission/permission.dart'; import 'package:sort_it/src/screens/profile/profile.dart'; import 'package:sort_it/src/screens/scan/scan.dart'; import 'package:sort_it/src/screens/settings/settings.dart'; import 'package:sort_it/src/screens/sign_in/sign_in.dart'; import 'package:sort_it/src/screens/sign_up/components/otp.dart'; import 'package:sort_it/src/screens/sign_up/sign_up.dart'; import 'package:sort_it/src/screens/welcome/welcome.dart'; import 'package:sort_it/src/screens/success/success.dart'; import 'package:sort_it/src/screens/test/test.dart'; final Map<String, WidgetBuilder> routes = { ///------------------App Flow With Routes -------------------/// /// | Start - Screen Welcome | /// ---------OTP Screen------- /// -Subsequent as shown below- /// --------------|----------- /// | End Screen Test Screen | Welcome.routeName: (context) => Welcome(), SignIn.routeName: (context) => SignIn(), SignUp.routeName: (context) => SignUp(), Otp.routeName: (context) => Otp(), PermissionsPage.routeName: (context) => PermissionsPage(), Choice.routeName: (context) => Choice(), CompleteProfile.routeName: (context) => CompleteProfile(), Success.routeName: (context) => Success(), Home.routeName: (context) => Home(), Settings.routeName: (context) => Settings(), Scan.routeName: (context) => Scan(), MapPreview.routeName: (context) => MapPreview(), Profile.routeName: (context) => Profile(), EditProfile.routeName: (context) => EditProfile(), Test.routeName: (context) => Test(), };
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/phone_field.dart
import 'package:country_code_picker/country_code_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class PhoneField extends StatelessWidget { final String hint; final TextEditingController controller; const PhoneField({Key? key, required this.hint, required this.controller}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), height: 37.h, child: TextFormField( controller: controller, style: Theme.of(context).textTheme.headline2, keyboardType: TextInputType.number, decoration: InputDecoration( fillColor: Color(0xFF30444E), contentPadding: new EdgeInsets.only(top: 9.h), border: InputBorder.none, prefixIcon: Prefix(), hintText: hint, hintStyle: Theme.of(context).textTheme.headline2), ), ); } } class Prefix extends StatelessWidget { const Prefix({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return CountryCodePicker( onChanged: print, // Initial selection and favorite can be one of code ('IT') OR dial_code('+39') initialSelection: 'IN', favorite: ['+91', 'IN'], // optional. Shows only country name and flag showCountryOnly: false, // optional. Shows only country name and flag when popup is closed. showOnlyCountryWhenClosed: false, // optional. aligns the flag and the Text left alignLeft: false, // Text Style Custom textStyle: Theme.of(context).textTheme.headline2, boxDecoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), searchDecoration: InputDecoration( fillColor: Color(0xFF30444E), //contentPadding: new EdgeInsets.symmetric(vertical: 12), border: InputBorder.none, hintStyle: Theme.of(context).textTheme.headline4), ); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/custom_button.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class CustomButton extends StatelessWidget { final String buttonText; final Color buttonColor; final Color textColor; final bool? leading; final VoidCallback onTap; const CustomButton( {Key? key, required this.buttonText, required this.buttonColor, required this.textColor, this.leading, required this.onTap}) : super(key: key); @override Widget build(BuildContext context) { return // Figma Flutter Generator Sign_buttonWidget - INSTANCE InkWell( onTap: onTap, child: Container( width: 315, height: 58, decoration: BoxDecoration( color: buttonColor, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( color: Color.fromRGBO(15, 218, 136, 0.3), offset: Offset(0, 2), blurRadius: 4) ], // gradient: LinearGradient( // begin: Alignment(0, 1), // end: Alignment(-1, 0), // colors: [ // Color.fromRGBO(63, 223, 158, 1), // Color.fromRGBO(62, 213, 152, 1) // ]), ), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( buttonText, textAlign: TextAlign.center, style: Theme.of(context) .textTheme .headline3! .copyWith(color: textColor, fontSize: 20.w), ), SizedBox( width: 5.h, ), leading == true ? Icon( FontAwesomeIcons.arrowRight, color: textColor, size: 17, ) : SizedBox(), ], ), )), ); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/password_field.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart'; import 'package:sort_it/controller/sign_up_controller.dart'; class PasswordField extends StatelessWidget { final String hinttext; PasswordField({Key? key, required this.hinttext}) : super(key: key); SignUpController _controller = Get.put(SignUpController()); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), height: 60.0, child: Obx( () => TextFormField( style: Theme.of(context).textTheme.headline2, obscureText: _controller.isObscure.value, validator: (val) { String? msg = _controller.validatePassword(val!); if (msg != null) Fluttertoast.showToast(msg: msg); }, onSaved: (val) => _controller.password.value = val!, decoration: InputDecoration( fillColor: Color(0xFF30444E), contentPadding: new EdgeInsets.only(bottom: 3.h), border: InputBorder.none, prefixIcon: Prefix(), suffix: Suffix(), hintText: hinttext, hintStyle: Theme.of(context).textTheme.headline2), ), ), ); } Widget Prefix() { return Padding( padding: const EdgeInsets.only(right: 8.0), child: Container( width: 25, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF623A42), ), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Icon( FontAwesomeIcons.lock, color: Color(0xFFFF575F), ), ), ), ); } Widget Suffix() { return Obx( () => IconButton( icon: Icon( _controller.isObscure.value ? FontAwesomeIcons.solidEyeSlash : FontAwesomeIcons.solidEye, color: Color(0xFFFF575F), ), onPressed: () { _controller.changeObscure(); }, ), ); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/code_field.dart
import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class CodeField extends StatelessWidget { final TextEditingController tec; final String hint; const CodeField({Key? key, required this.hint, required this.tec}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), height: 60.0, child: TextFormField( controller: tec, style: Theme.of(context).textTheme.headline2, decoration: InputDecoration( fillColor: Color(0xFF30444E), contentPadding: new EdgeInsets.symmetric(vertical: 12), border: InputBorder.none, prefixIcon: Prefix(), hintText: hint, hintStyle: Theme.of(context).textTheme.headline2), ), ); } } Widget Prefix() { return Padding( padding: const EdgeInsets.only(right: 8.0), child: Container( width: 25, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xffafd0cb), ), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: SvgPicture.asset( 'assets/icons/qr_code.svg', color: Color(0xff3DD598), ), ), ), ); }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/name_field.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class NameField extends StatelessWidget { final TextEditingController tec; final String hint; const NameField({Key? key, required this.hint, required this.tec}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), height: 60.0, child: TextFormField( controller: tec, style: Theme.of(context).textTheme.headline2, decoration: InputDecoration( fillColor: Color(0xFF30444E), contentPadding: new EdgeInsets.symmetric(vertical: 12), border: InputBorder.none, prefixIcon: Prefix(), hintText: hint, hintStyle: Theme.of(context).textTheme.headline2), ), ); } } Widget Prefix() { return Padding( padding: const EdgeInsets.only(right: 8.0), child: Container( width: 25, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color.fromRGBO(98, 91, 57, 1), ), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Icon( FontAwesomeIcons.solidUser, color: Color(0xFFFFC542), ), ), ), ); }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/bottom_nav_bar.dart
import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart'; import 'package:sort_it/controller/home_controller.dart'; Container CustomBottomNavbar(BuildContext context, HomeController c) { Widget BottomNavbarItem( {required String text, required IconData icon, required int currentIndex}) { return GestureDetector( onTap: () { c.onTappedBar(currentIndex); }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(50), boxShadow: c.selectedIndex.value == currentIndex ? [ BoxShadow( color: Color(0xff3DD598), spreadRadius: 5, blurRadius: 0, //offset: Offset(-1, 5), // changes position of shadow ), ] : [], ), padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 2.h), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Icon( icon, color: c.selectedIndex.value == currentIndex ? Colors.white : Color(0xff9796ae), size: 25, ), SizedBox(height: 4), Text( text, style: TextStyle( color: c.selectedIndex.value == currentIndex ? Colors.white : Color(0xff9796ae), fontFamily: 'abzr', fontSize: 11.w, letterSpacing: 0.06, fontWeight: FontWeight.normal, height: 1.2), ), ], ), ), ); } return Container( width: 390, height: 80, decoration: BoxDecoration( color: Color(0xFF30444E), borderRadius: BorderRadius.only( topLeft: Radius.circular(40), topRight: Radius.circular(40), )), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Obx( () => Container( padding: EdgeInsets.symmetric(horizontal: 16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ BottomNavbarItem( icon: Icons.home_rounded, text: 'Home', currentIndex: 0), BottomNavbarItem( icon: Icons.search_rounded, text: 'Discover', currentIndex: 1), BottomNavbarItem(icon: Icons.map, text: 'Map', currentIndex: 2), BottomNavbarItem( icon: Icons.account_circle_rounded, text: 'Profile', currentIndex: 3), BottomNavbarItem( icon: Icons.settings, text: 'Settings', currentIndex: 4), BottomNavbarItem( icon: Icons.ac_unit, text: 'Coin', currentIndex: 5), ], ), ), ), SizedBox( height: 7.h, ), Align( alignment: Alignment.bottomCenter, child: Container( height: 6, width: 80.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(50), color: Colors.white, ), ), ), ], ), ); }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/address_field.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class AddressField extends StatelessWidget { final TextEditingController tec; final String hint; const AddressField({Key? key, required this.hint, required this.tec}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), height: 60.0, child: TextFormField( controller: tec, style: Theme.of(context).textTheme.headline2, decoration: InputDecoration( fillColor: Color(0xFF30444E), contentPadding: new EdgeInsets.symmetric(vertical: 12), border: InputBorder.none, prefixIcon: Prefix(), hintText: hint, hintStyle: Theme.of(context).textTheme.headline2), ), ); } } Widget Prefix() { return Padding( padding: const EdgeInsets.only(right: 8.0), child: Container( width: 25, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xffafd0cb), ), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Icon( Icons.location_on, color: Color(0xff4f867e), ), ), ), ); }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/app_drawer.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart'; class AppDrawer extends StatelessWidget { AppDrawer({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Drawer( backgroundColor: Color(0xFF475E69), child: buildMenu(context), ); } Widget buildMenu(BuildContext context) { return SingleChildScrollView( padding: EdgeInsets.symmetric(vertical: 50.h, horizontal: 10.h), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( clipBehavior: Clip.none, children: [ Container( decoration: BoxDecoration( border: Border.all( color: Color(0xFF96A7AF), width: 2, ), borderRadius: BorderRadius.circular(25), ), padding: EdgeInsets.only( left: 10.h, right: 10.h, top: 0.1.sh, bottom: 30.h, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Sort It User', style: Theme.of(context).textTheme.headline2!.copyWith( color: Colors.white, ), ), SizedBox( width: 5.w, ), Icon( FontAwesomeIcons.solidCheckCircle, size: 15, color: Colors.white, ), ], ), Text( 'A15, WePeople, Street L1, NY', style: Theme.of(context).textTheme.headline3, ), QrImage( data: 'This QR code has an embedded image as well', version: QrVersions.auto, foregroundColor: Colors.white, size: 80.h, gapless: false, embeddedImageStyle: QrEmbeddedImageStyle( size: Size(80, 80), ), ), Text( 'Scan this code', style: Theme.of(context).textTheme.headline2!.copyWith( color: Colors.white, ), ), ], ), ), Positioned( left: 50.h, top: -20.h, child: CircleAvatar( backgroundColor: Colors.white, radius: 50.0.w, child: Image.asset('assets/images/user.png'), ), ), ], ), SizedBox( height: 20.h, ), ListTile( onTap: () {}, leading: const Icon(Icons.home, size: 20.0, color: Colors.white), title: const Text("Home"), textColor: Colors.white, dense: true, ), ListTile( onTap: () {}, leading: const Icon(Icons.verified_user, size: 20.0, color: Colors.white), title: const Text("Profile"), textColor: Colors.white, dense: true, // padding: EdgeInsets.zero, ), ListTile( onTap: () {}, leading: const Icon(Icons.monetization_on, size: 20.0, color: Colors.white), title: const Text("Wallet"), textColor: Colors.white, dense: true, // padding: EdgeInsets.zero, ), ListTile( onTap: () {}, leading: const Icon(Icons.shopping_cart, size: 20.0, color: Colors.white), title: const Text("Cart"), textColor: Colors.white, dense: true, // padding: EdgeInsets.zero, ), ListTile( onTap: () {}, leading: const Icon(Icons.star_border, size: 20.0, color: Colors.white), title: const Text("Favorites"), textColor: Colors.white, dense: true, // padding: EdgeInsets.zero, ), ListTile( onTap: () {}, leading: const Icon(Icons.settings, size: 20.0, color: Colors.white), title: const Text("Settings"), textColor: Colors.white, dense: true, // padding: EdgeInsets.zero, ), ], ), ); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/email_field.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class EmailField extends StatelessWidget { final String hint; final TextEditingController controller; const EmailField({Key? key, required this.hint, required this.controller}) : super(key: key); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), height: 60.0, child: TextFormField( controller: controller, style: Theme.of(context).textTheme.headline2, decoration: InputDecoration( fillColor: Color(0xFF30444E), contentPadding: new EdgeInsets.symmetric(vertical: 12), border: InputBorder.none, prefixIcon: Prefix(), hintText: hint, hintStyle: Theme.of(context).textTheme.headline2), ), ); } } Widget Prefix() { return Padding( padding: const EdgeInsets.only(right: 8.0), child: Container( width: 25, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color.fromRGBO(98, 91, 57, 1), ), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Icon( FontAwesomeIcons.envelope, color: Color(0xFFFFC542), ), ), ), ); }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/components/app_bar.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:sort_it/controller/home_controller.dart'; class CustomHeader extends StatelessWidget { final HomeController hc; const CustomHeader({Key? key, required this.hc}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, //vertical: 0.05.sh, ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( onPressed: () { hc.scaffoldKey.currentState!.openDrawer(); }, icon: Icon( FontAwesomeIcons.bars, color: Colors.white, ), ), IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.shoppingCart, color: Colors.white, ), ), ], ), ); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/model/welcome_model.dart
class WelcomePoster { String image; String heading; String caption; int index; WelcomePoster( {required this.image, required this.heading, required this.caption, required this.index}); }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/model/user_model.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:meta/meta.dart'; import 'dart:convert'; UserModel userModelFromJson(String str) => UserModel.fromJson(json.decode(str)); String userModelToJson(UserModel data) => json.encode(data.toJson()); class UserModel { UserModel({ required this.coins, required this.profile, }); final Coins coins; final Profile profile; factory UserModel.fromJson(Map<String, dynamic> json) => UserModel( coins: Coins.fromJson(json["coins"]), profile: Profile.fromJson(json["profile"]), ); Map<String, dynamic> toJson() => { "coins": coins.toJson(), "profile": profile.toJson(), }; } class Coins { Coins({ required this.totalEarned, required this.totalSpent, required this.earnHistory, required this.spentHistory, }); final int totalEarned; final int totalSpent; final List<History> earnHistory; final List<History> spentHistory; factory Coins.fromJson(Map<String, dynamic> json) => Coins( totalEarned: json["total_earned"], totalSpent: json["total_spent"], earnHistory: List<History>.from( json["earn_history"].map((x) => History.fromJson(x))), spentHistory: List<History>.from( json["spent_history"].map((x) => History.fromJson(x))), ); Map<String, dynamic> toJson() => { "total_earned": totalEarned, "total_spent": totalSpent, "earn_history": List<dynamic>.from(earnHistory.map((x) => x.toJson())), "spent_history": List<dynamic>.from(spentHistory.map((x) => x.toJson())), }; } class History { History({ required this.time, required this.value, }); final int time; final int value; factory History.fromJson(Map<String, dynamic> json) => History( time: json["time"], value: json["value"], ); Map<String, dynamic> toJson() => { "time": time, "value": value, }; } class Profile { Profile({ required this.image, required this.uid, required this.phone, required this.name, required this.location, required this.email, }); final String image; final String uid; final String phone; final String name; final Location location; final String email; factory Profile.fromJson(Map<String, dynamic> json) => Profile( image: json["image"], uid: json["uid"], phone: json["phone"], name: json["name"], location: Location.fromJson(json["location"]), email: json["email"], ); Map<String, dynamic> toJson() => { "image": image, "uid": uid, "phone": phone, "name": name, "location": location.toJson(), "email": email, }; } class Location { Location({ required this.address, required this.coordinates, }); final String address; final GeoPoint coordinates; factory Location.fromJson(Map<String, dynamic> json) => Location( address: json["address"], coordinates: json["coordinates"], ); Map<String, dynamic> toJson() => { "address": address, "coordinates": coordinates, }; }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/service/navigation.dart
import 'package:flutter/material.dart'; class NavigationService { final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>(); Future navigateTo(String routeName, {Object? arguments, bool withreplacement = false}) { if (withreplacement) { return navigatorKey.currentState!.pushNamedAndRemoveUntil( routeName, (route) => false, arguments: arguments); } else { return navigatorKey.currentState! .pushNamed(routeName, arguments: arguments); } } bool pop({required String routeName, Object? argument}) { navigatorKey.currentState!.pop(); return true; } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/sign_in/sign_in.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:lottie/lottie.dart'; import 'package:sort_it/src/screens/home/home.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/src/screens/sign_up/sign_up.dart'; import 'components/bunny.dart'; class SignIn extends StatefulWidget { static String routeName = '/sign-in'; @override State<SignIn> createState() => _SignInState(); } const Color _textColor = Color.fromRGBO(150, 167, 175, 1); class _SignInState extends State<SignIn> with TickerProviderStateMixin { late AnimationController _controller; late Bunny _bunny; @override void initState() { super.initState(); _controller = AnimationController(vsync: this); _controller.stop(); _bunny = Bunny(_controller); } @override void dispose() { _controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { final double textFieldWidth = MediaQuery.of(context).size.width - 32; return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 0.1.sh, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ // Container( // width: 50, // height: 50, // // decoration: BoxDecoration( // // borderRadius: BorderRadius.circular(12), // // boxShadow: [ // // BoxShadow( // // color: Color.fromRGBO(15, 218, 136, 0.3), // // offset: Offset(0, 2), // // blurRadius: 4) // // ], // // gradient: LinearGradient( // // begin: Alignment(0, 1), // // end: Alignment(-1, 0), // // colors: [ // // Color.fromRGBO(63, 223, 158, 1), // // Color.fromRGBO(62, 213, 152, 1) // // ]), // // ) // child: Image.asset('assets/images/logo.png'), // ), // Text( // 'Welcome', // style: Theme.of(context).textTheme.headline1, // ), // Text( // 'Sign in to continue', // style: Theme.of(context).textTheme.headline2, // ), //SizedBox(height: 32.h), Align( alignment: Alignment.center, child: Lottie.asset( 'assets/lottie/bunny_mouth.json', width: 0.35.sw, height: 0.17.sh, controller: _controller, fit: BoxFit.fill, onLoaded: (composition) { setState(() { _controller.duration = composition.duration; }); }, ), ), _MyTextField( labelText: 'Email', keyboardType: TextInputType.emailAddress, onHasFocus: (isObscure) { /// 获取焦点,开始文字跟踪状态 _bunny.setTrackingState(); }, onChanged: (text) { _bunny.setEyesPosition(_getTextSize(text) / textFieldWidth); }, ), _MyTextField( labelText: 'Password', keyboardType: TextInputType.visiblePassword, obscureText: true, onHasFocus: (isObscure) { /// 获取焦点,设置状态 if (isObscure) { _bunny.setShyState(); } else { _bunny.setPeekState(); } }, onObscureText: (isObscure) { if (isObscure) { _bunny.setShyState(); } else { _bunny.setPeekState(); } }, ), CustomButton( buttonText: 'Sign In', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), leading: true, onTap: () { Navigator.of(context).pushNamed(Home.routeName); }, ), // Figma Flutter Generator ForgotWidget - TEXT Align( alignment: Alignment.center, child: Text( 'Forgot password?', textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline3, ), ), CustomButton( buttonText: 'Create an account', textColor: Color.fromRGBO(63, 223, 158, 1), buttonColor: Color(0xFF286053), onTap: () => Navigator.of(context).pushNamed(SignUp.routeName), ), ], ), ), ), ); } double _getTextSize(String text) { final TextPainter textPainter = TextPainter( text: TextSpan( text: text, style: const TextStyle( fontSize: 16.0, )), maxLines: 1, textDirection: TextDirection.ltr, )..layout(); return textPainter.size.width; } } class _MyTextField extends StatefulWidget { const _MyTextField( {Key? key, required this.labelText, this.obscureText = false, this.keyboardType, this.onHasFocus, this.onObscureText, this.onChanged}) : super(key: key); final String labelText; final bool obscureText; final TextInputType? keyboardType; /// 获取焦点监听 final Function(bool isObscure)? onHasFocus; /// 密码可见监听 final Function(bool isObscure)? onObscureText; /// 文字输入监听 final Function(String text)? onChanged; @override _MyTextFieldState createState() => _MyTextFieldState(); } class _MyTextFieldState extends State<_MyTextField> { bool _isObscure = true; final FocusNode _focusNode = FocusNode(); @override void initState() { super.initState(); _focusNode.addListener(_refresh); } void _refresh() { if (_focusNode.hasFocus && widget.onHasFocus != null) { widget.onHasFocus?.call(_isObscure); } setState(() {}); } @override void dispose() { _focusNode.removeListener(_refresh); _focusNode.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color(0xFF30444E), ), padding: const EdgeInsets.all(8.0), height: 60.0, child: Listener( onPointerDown: (e) => FocusScope.of(context).requestFocus(_focusNode), child: TextField( focusNode: _focusNode, style: Theme.of(context).textTheme.headline2, textInputAction: TextInputAction.next, decoration: InputDecoration( fillColor: Color(0xFF30444E), contentPadding: new EdgeInsets.symmetric(vertical: 12), border: InputBorder.none, prefixIcon: Prefix(), hintText: widget.labelText, hintStyle: Theme.of(context).textTheme.headline2, suffixIcon: widget.obscureText ? IconButton( icon: Icon( _isObscure ? Icons.visibility_off : Icons.visibility, color: _textColor, ), onPressed: () { setState(() { _isObscure = !_isObscure; }); if (widget.onObscureText != null) { widget.onObscureText?.call(_isObscure); } }, ) : null, ), keyboardType: widget.keyboardType, obscureText: widget.obscureText ? _isObscure : widget.obscureText, onChanged: widget.onChanged, ), ), ); } } Widget Prefix() { return Padding( padding: const EdgeInsets.only(right: 8.0), child: Container( width: 25, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Color.fromRGBO(98, 91, 57, 1), ), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Icon( FontAwesomeIcons.solidUser, color: Color(0xFFFFC542), ), ), ), ); }
0
mirrored_repositories/sort_it/lib/src/screens/sign_in
mirrored_repositories/sort_it/lib/src/screens/sign_in/components/bunny.dart
import 'package:flutter/material.dart'; class Bunny { Bunny(this.controller) { setNeutralState(); } AnimationController controller; /// 各种状态过渡的起始帧数 static const List<int> _neutral_to_tracking = [4, 22]; static const List<int> _tracking_to_neutral = [0, 0]; static const List<int> _neutral_to_shy = [29, 39]; static const List<int> _shy_to_neutral = [44, 54]; static const List<int> _neutral_to_peek = [76, 68]; static const List<int> _peek_to_neutral = [68, 76]; static const List<int> _shy_to_peek = [59, 68]; static const List<int> _peek_to_shy = [68, 59]; BunnyState currentState = BunnyState.neutral; void setNeutralState() { switch (currentState) { case BunnyState.neutral: return; case BunnyState.tracking: setMinMaxFrame(_tracking_to_neutral); break; case BunnyState.shy: setMinMaxFrame(_shy_to_neutral); break; case BunnyState.peek: setMinMaxFrame(_peek_to_neutral); break; } currentState = BunnyState.neutral; } void setShyState() { switch (currentState) { case BunnyState.neutral: case BunnyState.tracking: setMinMaxFrame(_neutral_to_shy); break; case BunnyState.shy: return; case BunnyState.peek: setMinMaxFrame(_peek_to_shy); break; } currentState = BunnyState.shy; } void setPeekState() { switch (currentState) { case BunnyState.neutral: case BunnyState.tracking: setMinMaxFrame(_neutral_to_peek); break; case BunnyState.shy: setMinMaxFrame(_shy_to_peek); break; case BunnyState.peek: return; } currentState = BunnyState.peek; } void setTrackingState() { switch (currentState) { case BunnyState.neutral: setMinMaxFrame(_tracking_to_neutral); break; case BunnyState.tracking: return; case BunnyState.shy: setMinMaxFrame(_shy_to_neutral); break; case BunnyState.peek: setMinMaxFrame(_peek_to_neutral); break; } currentState = BunnyState.tracking; } void setEyesPosition(double progress) { if (currentState != BunnyState.tracking) { setMinMaxFrame(_tracking_to_neutral); currentState = BunnyState.tracking; return; } if (progress > 1) { return; } final double frame = (_neutral_to_tracking[1] - _neutral_to_tracking[0]) * progress; controller.animateTo( framesToPercentage(frame.toInt() + _neutral_to_tracking[0]), duration: Duration.zero); } void setMinMaxFrame(List<int> frames) { /// 移动至起始帧 controller.animateTo(framesToPercentage(frames[0]), duration: Duration.zero); /// 动画至结束帧 controller.animateTo(framesToPercentage(frames[1])); } /// 共77帧。将已知帧数转为百分比 double framesToPercentage(int frame) { return frame / 77; } } enum BunnyState { /// 默认状态 neutral, /// 跟踪(文字输入) tracking, /// 害羞(密码不可见) shy, /// 偷看(密码可见) peek }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/test/test.dart
import 'dart:developer'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; import 'package:sort_it/controller/scan_controller.dart'; import 'package:sort_it/controller/test_controller.dart'; import 'dart:io'; import 'package:sort_it/src/screens/scan/scan.dart'; ///---------------------------This Screen is testing screen test all your components and widgets here-----------------/// ///----------------------------------------Remove Components After Use-----------------------------------------------/// ///-----------------------------Currently Under Test : QR Scanner Library-----------------------------------------/// class Test extends StatefulWidget { static String routeName = 'test'; const Test({Key? key}) : super(key: key); @override State<Test> createState() => _TestState(); } class _TestState extends State<Test> { final TestController t = Get.put(TestController()); // final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); // Barcode? result; // QRViewController? controller; // // // In order to get hot reload to work we need to pause the camera if the platform // // is android, or resume the camera if the platform is iOS. // @override // void reassemble() { // super.reassemble(); // if (Platform.isAndroid) { // controller!.pauseCamera(); // } else if (Platform.isIOS) { // controller!.resumeCamera(); // } // } // // void _onQRViewCreated(QRViewController controller) { // this.controller = controller; // controller.scannedDataStream.listen((scanData) { // setState(() { // result = scanData; // }); // }); // } // // @override // void dispose() { // controller?.dispose(); // super.dispose(); // } @override Widget build(BuildContext context) { // printScreenInformation(); return Scaffold( appBar: AppBar( title: Text('🧪 Testing Screen..'), ), body: Center( child: ElevatedButton( onPressed: () { Navigator.of(context).push(MaterialPageRoute( builder: (context) => Scan(), )); }, child: const Text('qrView'), ), ), ); } } //-----------------Screen Information -------------------// void printScreenInformation() { print('Device width dp:${1.sw}dp'); print('Device height dp:${1.sh}dp'); print('Device pixel density:${ScreenUtil().pixelRatio}'); print('Bottom safe zone distance dp:${ScreenUtil().bottomBarHeight}dp'); print('Status bar height dp:${ScreenUtil().statusBarHeight}dp'); print('The ratio of actual width to UI design:${ScreenUtil().scaleWidth}'); print('The ratio of actual height to UI design:${ScreenUtil().scaleHeight}'); print('System font scaling:${ScreenUtil().textScaleFactor}'); print('0.5 times the screen width:${0.5.sw}dp'); print('0.5 times the screen height:${0.5.sh}dp'); print('Screen orientation:${ScreenUtil().orientation}'); } class QRViewExample extends StatefulWidget { const QRViewExample({Key? key}) : super(key: key); @override State<StatefulWidget> createState() => _QRViewExampleState(); } class _QRViewExampleState extends State<QRViewExample> { Barcode? result; QRViewController? controller; final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); // In order to get hot reload to work we need to pause the camera if the platform // is android, or resume the camera if the platform is iOS. @override void reassemble() { super.reassemble(); if (Platform.isAndroid) { controller!.pauseCamera(); } controller!.resumeCamera(); } @override Widget build(BuildContext context) { return Scaffold( body: Column( children: <Widget>[ Expanded(flex: 4, child: _buildQrView(context)), Expanded( flex: 1, child: FittedBox( fit: BoxFit.contain, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ if (result != null) Text( 'Barcode Type: ${describeEnum(result!.format)} Data: ${result!.code}') else const Text('Scan a code'), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Container( margin: const EdgeInsets.all(8), child: ElevatedButton( onPressed: () async { await controller?.toggleFlash(); setState(() {}); }, child: FutureBuilder( future: controller?.getFlashStatus(), builder: (context, snapshot) { return Text('Flash: ${snapshot.data}'); }, )), ), Container( margin: const EdgeInsets.all(8), child: ElevatedButton( onPressed: () async { await controller?.flipCamera(); setState(() {}); }, child: FutureBuilder( future: controller?.getCameraInfo(), builder: (context, snapshot) { if (snapshot.data != null) { return Text( 'Camera facing ${describeEnum(snapshot.data!)}'); } else { return const Text('loading'); } }, )), ) ], ), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Container( margin: const EdgeInsets.all(8), child: ElevatedButton( onPressed: () async { await controller?.pauseCamera(); }, child: const Text('pause', style: TextStyle(fontSize: 20)), ), ), Container( margin: const EdgeInsets.all(8), child: ElevatedButton( onPressed: () async { await controller?.resumeCamera(); }, child: const Text('resume', style: TextStyle(fontSize: 20)), ), ) ], ), ], ), ), ) ], ), ); } Widget _buildQrView(BuildContext context) { // For this example we check how width or tall the device is and change the scanArea and overlay accordingly. var scanArea = (MediaQuery.of(context).size.width < 400 || MediaQuery.of(context).size.height < 400) ? 150.0 : 300.0; // To ensure the Scanner view is properly sizes after rotation // we need to listen for Flutter SizeChanged notification and update controller return QRView( key: qrKey, onQRViewCreated: _onQRViewCreated, overlay: QrScannerOverlayShape( borderColor: Color.fromRGBO(31, 46, 53, 1), borderRadius: 10, borderLength: 30, borderWidth: 10, cutOutSize: scanArea), onPermissionSet: (ctrl, p) => _onPermissionSet(context, ctrl, p), ); } void _onQRViewCreated(QRViewController controller) { setState(() { this.controller = controller; }); controller.scannedDataStream.listen((scanData) { setState(() { result = scanData; }); }); // print( // 'Barcode Type: ${describeEnum(result!.format)} Data: ${result!.code}'); } void _onPermissionSet(BuildContext context, QRViewController ctrl, bool p) { log('${DateTime.now().toIso8601String()}_onPermissionSet $p'); if (!p) { ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('no Permission')), ); } } @override void dispose() { controller?.dispose(); super.dispose(); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/complete/complete_profile.dart
import 'package:flutter/material.dart'; import 'components/body.dart'; class CompleteProfile extends StatelessWidget { static String routeName = '/complete-profile'; CompleteProfile({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Body(), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/complete
mirrored_repositories/sort_it/lib/src/screens/complete/components/passord_details.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/components/email_field.dart'; import 'package:sort_it/components/password_field.dart'; class PasswordDetails extends StatelessWidget { const PasswordDetails({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Hello', style: Theme.of(context).textTheme.headline1, ), SizedBox( height: 10.h, ), Text( 'User Name', style: Theme.of(context).textTheme.headline2, ), SizedBox( height: 20.h, ), PasswordField(hinttext: 'Create password'), SizedBox( height: 10.h, ), PasswordField(hinttext: 'Retype your password'), ], ); } }
0
mirrored_repositories/sort_it/lib/src/screens/complete
mirrored_repositories/sort_it/lib/src/screens/complete/components/user_details.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/components/email_field.dart'; import 'package:sort_it/components/name_field.dart'; import 'package:sort_it/controller/complete_controller.dart'; class UserDetails extends StatelessWidget { UserDetails({Key? key}) : super(key: key); final CompleteProfileController cp = Get.find(); @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Hello', style: Theme.of(context).textTheme.headline1, ), SizedBox( height: 10.h, ), Text( 'lets introduce', style: Theme.of(context).textTheme.headline2, ), SizedBox( height: 20.h, ), NameField( hint: 'Your name', tec: cp.nameController, ), SizedBox( height: 10.h, ), EmailField( hint: 'Your email', controller: cp.emailController, ), ], ); } }
0
mirrored_repositories/sort_it/lib/src/screens/complete
mirrored_repositories/sort_it/lib/src/screens/complete/components/body.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/controller/complete_controller.dart'; import 'package:sort_it/src/screens/complete/complete_profile.dart'; import 'package:sort_it/src/screens/complete/components/passord_details.dart'; import 'package:sort_it/src/screens/complete/components/user_details.dart'; import 'package:sort_it/src/screens/success/success.dart'; class Body extends StatelessWidget { Body({Key? key}) : super(key: key); final CompleteProfileController cp = Get.put(CompleteProfileController()); @override Widget build(BuildContext context) { return Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 0.1.sh, ), child: Obx( () => Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 50, height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( color: Color.fromRGBO(15, 218, 136, 0.3), offset: Offset(0, 2), blurRadius: 10) ], gradient: LinearGradient( begin: Alignment(0, 1), end: Alignment(-1, 0), colors: [ Color.fromRGBO(63, 223, 158, 1), Color.fromRGBO(62, 213, 152, 1) ]), ), child: Image.asset('assets/images/logo.png'), ), cp.passwordState.value ? PasswordDetails() : UserDetails(), Row( children: [ Flexible( flex: 1, child: CustomButton( buttonText: '', textColor: Color.fromRGBO(63, 223, 158, 1), buttonColor: Color(0xFF286053), leading: false, onTap: () { if (cp.passwordState.value) { cp.goToPassword(newval: false); } else { Get.close(1); } }, ), ), SizedBox( width: 10.w, ), Flexible( flex: 4, child: CustomButton( buttonText: 'Next', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), leading: true, onTap: () { if (cp.passwordState.value) { Get.toNamed(Success.routeName); } else { cp.goToPassword(newval: true); } }, ), ), ], ), ], ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/permission/permission.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:lottie/lottie.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/controller/permission_controller.dart'; import 'package:sort_it/src/screens/choice/choice.dart'; import 'package:sort_it/src/screens/complete/complete_profile.dart'; class PermissionsPage extends StatelessWidget { static String routeName = '/permissions'; PermissionsPage({Key? key}) : super(key: key); final PermissionController pc = Get.put(PermissionController()); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 0.1.sh, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( 'Enable Location', style: Theme.of(context).textTheme.headline1, ), Container( width: 0.3.sh, height: 0.3.sh, child: Lottie.asset('assets/lottie/location.json'), ), Text( 'We need to know your location in order to suggest nearby stations', textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline2, ), CustomButton( buttonText: 'Enable', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), leading: true, onTap: () { pc.getPermission(context); Navigator.of(context).pushNamed(Choice.routeName); }, ), ], ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/editprofile/editprofile.dart
import 'package:flutter/material.dart'; import 'components/body.dart'; class EditProfile extends StatelessWidget { static String routeName = '/edit-profile'; EditProfile({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Body(), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/editprofile
mirrored_repositories/sort_it/lib/src/screens/editprofile/components/upload.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:sort_it/controller/editprofile_controller.dart'; import 'dart:io'; class Upload extends StatelessWidget { Upload({Key? key}) : super(key: key); final EditProfileController ep = Get.find(); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { ep.showPicker(context); }, child: ep.pickedImage == null ? Container( decoration: BoxDecoration( color: Color(0xFF30444E), borderRadius: BorderRadius.all(Radius.elliptical(80, 80)), ), width: 55.h, height: 55.h, child: Icon( Icons.camera_alt, size: 20.h, color: Color.fromRGBO(150, 167, 175, 1), ), ) : CircleAvatar( radius: 50, backgroundColor: Color(0xFF30444E), backgroundImage: FileImage(ep.pickedImage as File), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/editprofile
mirrored_repositories/sort_it/lib/src/screens/editprofile/components/body.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:sort_it/components/address_field.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/components/email_field.dart'; import 'package:sort_it/components/name_field.dart'; import 'package:sort_it/components/phone_field.dart'; import 'package:sort_it/controller/editprofile_controller.dart'; import 'package:sort_it/src/screens/editprofile/components/upload.dart'; class Body extends StatelessWidget { Body({Key? key}) : super(key: key); final EditProfileController ep = Get.put(EditProfileController()); @override Widget build(BuildContext context) { return Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 0.1.sh, ), child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( 'Edit Profile', style: Theme.of(context).textTheme.headline1, ), SizedBox( height: 10.h, ), Upload(), SizedBox( height: 10.h, ), SizedBox( height: 10.h, ), NameField(hint: 'Name', tec: ep.nameController), SizedBox( height: 10.h, ), EmailField(hint: 'Email', controller: ep.emailController), SizedBox( height: 10.h, ), PhoneField(hint: '98', controller: ep.phoneController), SizedBox( height: 10.h, ), AddressField(hint: 'Address', tec: ep.addController), SizedBox( height: 10.h, ), CustomButton( buttonText: 'Save', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), leading: true, onTap: () {}, ), ], ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/coins/coins.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:sort_it/src/screens/coins/components/bottom_card.dart'; class Coins extends StatelessWidget { static String routeName = '/coins'; const Coins({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, // vertical: 0.1.sh, ), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( 'Till Today', style: Theme.of(context).textTheme.headline5, ), SizedBox( height: 5.h, ), Column( children: [ Text( '274', style: Theme.of(context).textTheme.headline1!.copyWith( fontWeight: FontWeight.bold, fontSize: 55.w, ), ), Text( ' Total Dumps ', style: Theme.of(context).textTheme.headline5, ), ], ), SizedBox( height: 15.h, ), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Icon( FontAwesomeIcons.rupeeSign, color: Colors.white, ), Text( '309.00', style: Theme.of(context).textTheme.headline1!.copyWith( fontWeight: FontWeight.bold, color: Color(0xff19fdfe), fontSize: 80.w, ), ), ], ), SizedBox( height: 15.h, ), Text( 'Keep Dumping', style: Theme.of(context).textTheme.headline5, ), Row( children: [ Container( height: 8.h, width: 8.h, decoration: BoxDecoration( color: Color(0xff19fdfe), borderRadius: BorderRadius.circular(50), ), ), Container( height: 2.h, width: 0.73.sw, decoration: BoxDecoration( color: Color(0xff19fdfe), borderRadius: BorderRadius.circular(50), ), ), Container( height: 8.h, width: 8.h, decoration: BoxDecoration( color: Color(0xff19fdfe), borderRadius: BorderRadius.circular(50), ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '0', style: Theme.of(context).textTheme.headline3, ), Text( '1', style: Theme.of(context).textTheme.headline3, ), ], ), SizedBox( height: 15.h, ), Container( height: 70.h, width: double.infinity, padding: EdgeInsets.symmetric(vertical: 7.h, horizontal: 7.w), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(5)), border: Border.all( color: Color.fromRGBO(150, 167, 175, 1), width: 2.0), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( color: Color.fromRGBO(31, 46, 53, 1), child: Text( 'YOU ARE ON', style: Theme.of(context).textTheme.headline4, ), ), SizedBox( height: 5.h, ), Text( 'LEVEL 1', style: Theme.of(context) .textTheme .headline1! .copyWith( fontWeight: FontWeight.bold, color: Color(0xff19fdfe), fontSize: 45.w, ), ), Text( 'Dispose your garbage efficiently and get rewarded regularly', style: Theme.of(context).textTheme.headline3, ), ], ), ), Container( height: 15.h, width: 15.h, decoration: BoxDecoration( color: Color(0xff19fdfe), borderRadius: BorderRadius.all( Radius.circular(50), ), ), child: Center( child: Icon( FontAwesomeIcons.solidStar, size: 15, ), ), ), ], ), ), SizedBox( height: 15.h, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ BottomCard( Heading: '2/4', text: 'Daily Rewards', ), BottomCard( Heading: '₹5', text: 'Invite a Friend', ), ], ), SizedBox( height: 15.h, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ BottomCard( Heading: '₹327', text: 'Coins', ), BottomCard( Heading: '800', text: 'Dumps', ), ], ), ], ), ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/coins
mirrored_repositories/sort_it/lib/src/screens/coins/components/bottom_card.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class BottomCard extends StatelessWidget { final String Heading; final String text; const BottomCard({Key? key, required this.Heading, required this.text}) : super(key: key); @override Widget build(BuildContext context) { return Container( height: 0.18.sh, width: 0.18.sh, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), ), child: Column( children: [ Flexible( flex: 2, child: Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), ), child: Center( child: Text( Heading, style: Theme.of(context).textTheme.headline1!.copyWith( fontWeight: FontWeight.bold, fontSize: 40.w, color: Color.fromRGBO(31, 46, 53, 1), ), ), ), ), ), Flexible( flex: 1, child: Container( decoration: BoxDecoration( color: Color(0xff19fdfe), borderRadius: BorderRadius.circular(10), ), child: Center( child: Text( text, style: Theme.of(context).textTheme.headline1!.copyWith( fontWeight: FontWeight.bold, fontSize: 20.w, color: Color.fromRGBO(31, 46, 53, 1), ), ), ), ), ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/profile/profile.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:sort_it/controller/profile_controller.dart'; import 'package:sort_it/src/screens/editprofile/editprofile.dart'; import 'package:get/get_navigation/src/extension_navigation.dart'; class Profile extends StatelessWidget { static String routeName = '/profile'; final ProfileController pc = Get.put(ProfileController()); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.05.sw, vertical: 0.1.sh, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Hi Auston', style: Theme.of(context).textTheme.headline1, ), // Container( // padding: EdgeInsets.all(10), // decoration: BoxDecoration( // borderRadius: BorderRadius.circular(30), // border: Border.all( // width: 1, // color: Color(0xFF96A7AF), // ), // ), // child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 0.2.sh, width: 0.25.sw, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), ), child: Image.asset( 'assets/images/cart_item1.png', fit: BoxFit.contain, ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Auston Martin', style: Theme.of(context) .textTheme .headline1! .copyWith(fontSize: 20.w), ), SizedBox( height: 10.h, ), Text( 'auston@gmail.com', style: Theme.of(context) .textTheme .headline1! .copyWith(fontSize: 20.w), ), SizedBox( height: 10.h, ), Text( '+91 27392 93823', style: Theme.of(context) .textTheme .headline1! .copyWith(fontSize: 20.w), ), ], ), InkWell( onTap: () { Get.toNamed(EditProfile.routeName); }, child: Container( width: 50.w, height: 25.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(32.5), boxShadow: [ BoxShadow( color: Color.fromRGBO(235, 235, 253, 1), offset: Offset(0, 1), blurRadius: 14) ], color: Color.fromRGBO(62, 213, 152, 1), border: Border.all( color: Color.fromRGBO(183, 237, 218, 1), width: 1, ), ), child: Icon( FontAwesomeIcons.pen, color: Colors.white, ), ), ), ], ), ], ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/scan/scan.dart
import 'package:flutter/material.dart'; import 'components/body.dart'; class Scan extends StatelessWidget { static String routeName = '/scan'; const Scan({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color.fromRGBO(31, 46, 53, 1), resizeToAvoidBottomInset: false, body: Body(), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/scan
mirrored_repositories/sort_it/lib/src/screens/scan/components/bottom_container.dart
import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/controller/scan_controller.dart'; class BottomContainer extends StatefulWidget { final QRViewController? controller; final Barcode? result; BottomContainer({Key? key, required this.controller, required this.result}) : super(key: key); @override State<BottomContainer> createState() => _BottomContainerState(); } class _BottomContainerState extends State<BottomContainer> { final ScanController sc = Get.find(); bool campause = false; bool showflash = false; @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(10.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(24), color: Color(0xFF30444E), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( height: 50.h, padding: EdgeInsets.all(10.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(24), color: Color.fromRGBO(31, 46, 53, 1), ), child: Row( children: [ Expanded( child: TextButton( child: FutureBuilder( future: widget.controller?.getFlashStatus(), builder: (context, snapshot) { if (snapshot.data != null) { if (snapshot.data! == 'false') return Icon( FontAwesomeIcons.bolt, color: Color(0xff3DD598), ); else return SvgPicture.asset( 'assets/icons/bolt-slash.svg', color: Color(0xff3DD598), ); } else { return Icon( FontAwesomeIcons.infinity, ); } }, ), onPressed: () async { await widget.controller?.toggleFlash(); setState(() {}); }, ), ), Expanded( child: TextButton( child: Icon( FontAwesomeIcons.image, color: Color(0xff3DD598), ), onPressed: () { Fluttertoast.showToast(msg: 'Feature Coming Soon'); }, ), ), Expanded( child: TextButton( child: FutureBuilder( future: widget.controller?.getCameraInfo(), builder: (context, snapshot) { if (snapshot.data != null) { return Icon( snapshot.data! == 'true' ? FontAwesomeIcons.play : FontAwesomeIcons.pause, color: Color(0xff3DD598), ); } else { return Icon( FontAwesomeIcons.infinity, ); } }, ), onPressed: () async { if (campause) { await widget.controller?.resumeCamera(); campause = false; } else { await widget.controller?.pauseCamera(); campause = true; } setState(() {}); }, ), ), Expanded( child: TextButton( child: FutureBuilder( future: widget.controller?.getCameraInfo(), builder: (context, snapshot) { if (snapshot.data != null) { return Icon( FontAwesomeIcons.camera, color: Color(0xff3DD598), ); } else { return Icon( FontAwesomeIcons.infinity, ); } }, ), onPressed: () async { await widget.controller?.flipCamera(); setState(() {}); }, ), ), ], ), ), SizedBox( height: 10.h, ), Row( children: [ Expanded( child: Padding( padding: EdgeInsets.symmetric(horizontal: 5.h), child: CustomButton( buttonText: 'Scan Code', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), leading: false, onTap: () { print('Data ${widget.result!.code}'); }, ), ), ), Expanded( child: Padding( padding: EdgeInsets.symmetric(horizontal: 5.h), child: CustomButton( buttonText: 'Enter Code', textColor: Color.fromRGBO(63, 223, 158, 1), buttonColor: Color(0xFF286053), leading: false, onTap: () {}, ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/scan
mirrored_repositories/sort_it/lib/src/screens/scan/components/body.dart
import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; import 'package:sort_it/components/code_field.dart'; import 'package:sort_it/controller/scan_controller.dart'; import 'package:sort_it/src/screens/scan/components/bottom_container.dart'; import 'package:sort_it/src/screens/success/success.dart'; import 'dart:io'; import '../scan.dart'; class Body extends StatefulWidget { Body({Key? key}) : super(key: key); @override State<Body> createState() => _BodyState(); } class _BodyState extends State<Body> { ///-------------VARIABLES--------------/// final ScanController sc = Get.put(ScanController()); Barcode? result; QRViewController? controller; final GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); @override void reassemble() { super.reassemble(); if (Platform.isAndroid) { controller!.pauseCamera(); } controller!.resumeCamera(); } @override Widget build(BuildContext context) { // For this example we check how width or tall the device is and change the scanArea and overlay accordingly. var scanArea = (MediaQuery.of(context).size.width < 400 || MediaQuery.of(context).size.height < 400) ? 80.h : 120.h; // To ensure the Scanner view is properly sizes after rotation // we need to listen for Flutter SizeChanged notification and update controller return Container( //height: 0.5.sh, padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 15.h, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( flex: 2, child: Column( children: [ SizedBox( height: 10.h, ), Align( alignment: Alignment.topLeft, child: ElevatedButton( onPressed: () { Get.close(1); }, style: ElevatedButton.styleFrom( shape: CircleBorder(), primary: Color(0xffd6d5d6), //padding: EdgeInsets.all(24), ), child: Icon( Icons.close, color: Colors.black, ), ), ), Text( 'Scan QR Code', style: Theme.of(context).textTheme.headline1!.copyWith( color: Colors.white, ), ), Text( 'Scan the QR code from garbage provider', textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline2!.copyWith( color: Colors.white, ), ), ], ), ), Expanded( flex: 5, child: QRView( key: qrKey, onQRViewCreated: onQRViewCreated, overlay: QrScannerOverlayShape( borderColor: Color.fromRGBO(31, 46, 53, 1), borderRadius: 10, borderLength: 30, borderWidth: 10, cutOutSize: scanArea), onPermissionSet: (ctrl, p) => onPermissionSet(context, ctrl, p), )), SizedBox( height: 10.h, ), Expanded( flex: 3, child: BottomContainer( controller: controller, result: result, ), ), ], ), ); } void onQRViewCreated(QRViewController controller) { setState(() { this.controller = controller; }); bool scanned = false; controller.scannedDataStream.listen((scanData) { if (!scanned) { controller.pauseCamera(); result = scanData; print(result!.code); Navigator.push( context, MaterialPageRoute( builder: (context) => Success(), ), ).then((value) => controller.resumeCamera()); } }); } void onPermissionSet(BuildContext context, QRViewController ctrl, bool p) { log('${DateTime.now().toIso8601String()}_onPermissionSet $p'); if (!p) { ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('no Permission')), ); } } @override void dispose() { controller?.dispose(); super.dispose(); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/success/success.dart
import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; import 'package:sort_it/src/screens/home/home.dart'; class Success extends StatelessWidget { static String routeName = '/success'; const Success({Key? key}) : super(key: key); void doSomeOperationPush(BuildContext context) { Future.delayed(Duration(seconds: 2), () { Navigator.of(context).pushNamed(Home.routeName); }); } @override Widget build(BuildContext context) { doSomeOperationPush(context); return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Center(child: Lottie.asset('assets/lottie/success.json')), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/entercode/entercode.dart
import 'package:flutter/material.dart'; class EnterCode extends StatelessWidget { static String routeName = '/enter-code'; const EnterCode({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container(); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/home/home.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:sort_it/components/app_bar.dart'; import 'package:sort_it/components/bottom_nav_bar.dart'; import 'package:sort_it/controller/home_controller.dart'; import 'package:sort_it/src/screens/coins/coins.dart'; import 'package:sort_it/src/screens/map/map.dart'; import 'package:sort_it/src/screens/profile/profile.dart'; import 'package:sort_it/src/screens/scan/scan.dart'; import 'package:sort_it/src/screens/settings/settings.dart'; import 'package:sort_it/src/screens/store/store.dart'; import 'package:sort_it/src/screens/test/test.dart'; import '../../../components/app_drawer.dart'; import 'components/body.dart'; class Home extends StatelessWidget { static String routeName = '/home'; Home({Key? key}) : super(key: key); final HomeController controller = Get.put(HomeController()); @override Widget build(BuildContext context) { return Scaffold( // key: controller.scaffoldKey, drawer: AppDrawer(), backgroundColor: Color.fromRGBO(31, 46, 53, 1), body: Column( children: [ SizedBox( height: 15.h, ), CustomHeader(hc: controller), Expanded( child: PageView( controller: controller.pageController, children: <Widget>[ Body(), Store(), Test(), Profile(), Settings(), Coins(), ], ), ), ], ), bottomNavigationBar: CustomBottomNavbar(context, controller), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/home
mirrored_repositories/sort_it/lib/src/screens/home/components/progress.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ProgressCard extends StatelessWidget { const ProgressCard({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( height: 50.h, width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h), decoration: BoxDecoration( color: Color(0xFF30444E), borderRadius: BorderRadius.circular(10), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( width: 0.17.sw, height: 40.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Color(0xFFFF565E), ), child: Icon( FontAwesomeIcons.arrowDown, color: Colors.white, ), ), Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Weekly Progress', style: Theme.of(context).textTheme.headline3, ), SizedBox( width: 0.1.sw, ), Text( '13%', style: Theme.of(context).textTheme.headline3!.copyWith( color: Color(0xFFFF565E), ), ), ], ), Container( width: 0.5.sw, height: 8.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: Color(0xFF2A3C44), ), child: Row( children: [ Container( width: 0.2.sw, height: 8.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: Color(0xFFFF565E), ), ), Spacer(), ], ), ), ], ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/home
mirrored_repositories/sort_it/lib/src/screens/home/components/card.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class CustomCard extends StatelessWidget { const CustomCard({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( height: 0.25.sh, width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), image: DecorationImage( image: AssetImage( 'assets/images/yellow_card.png', ), fit: BoxFit.cover, ), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Icon( FontAwesomeIcons.gift, color: Colors.white, ), Text( 'Weekly progress', style: Theme.of(context).textTheme.headline1!.copyWith(fontSize: 26.w), ), Text( 'It looks like you are on track. Please continue to follow your daily plan', textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline1!.copyWith(fontSize: 25.w), ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/home
mirrored_repositories/sort_it/lib/src/screens/home/components/body.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:sort_it/components/app_bar.dart'; import 'package:sort_it/src/screens/home/components/progress.dart'; import 'card.dart'; class Body extends StatelessWidget { const Body({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 0.05.sh, ), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomCard(), SizedBox( height: 10.h, ), Container( height: 0.25.sh, width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), image: DecorationImage( image: AssetImage( 'assets/images/sort_coin.png', ), fit: BoxFit.cover, ), ), ), SizedBox( height: 10.h, ), ProgressCard(), ], ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/sign_up/sign_up.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:lottie/lottie.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/components/phone_field.dart'; import 'package:sort_it/controller/sign_up_controller.dart'; import 'package:sort_it/src/screens/sign_up/components/otp.dart'; import 'package:sort_it/src/screens/success/success.dart'; class SignUp extends StatelessWidget { static String routeName = '/sign-up'; final SignUpController sc = Get.put(SignUpController()); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 0.1.sh, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Align( alignment: Alignment.center, child: Container( width: 0.3.sh, height: 0.3.sh, child: Lottie.asset('assets/lottie/otp.json'), ), ), Text( 'Sign Up', style: Theme.of(context).textTheme.headline1, ), Text( 'to start working', style: Theme.of(context).textTheme.headline2, ), PhoneField(hint: '98', controller: sc.phoneController), CustomButton( buttonText: 'Next', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), leading: true, onTap: () { Navigator.of(context).pushNamed(Otp.routeName); }, ), ], ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/sign_up
mirrored_repositories/sort_it/lib/src/screens/sign_up/components/otp.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:lottie/lottie.dart'; import 'package:sms_autofill/sms_autofill.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/controller/sign_up_controller.dart'; import 'package:sort_it/src/screens/permission/permission.dart'; import 'package:sort_it/src/screens/success/success.dart'; class Otp extends StatelessWidget { static String routeName = '/otp'; Otp({Key? key}) : super(key: key); final SignUpController sc = Get.find(); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 40.h), child: Form( child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Text( "Otp Verification", textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline1, ), SizedBox( height: 10.h, ), Text.rich( TextSpan(text: 'We have sent code at \n\n', children: [ TextSpan( text: '+91${sc.phoneController.text}', style: Theme.of(context).textTheme.headline3, ), const TextSpan(text: '\n\n please verify'), ]), textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline4, ), SizedBox( height: 10.h, ), buildTimer(context), SizedBox( height: 10.h, ), Align( alignment: Alignment.center, child: Container( width: 0.3.sh, height: 0.3.sh, child: Lottie.asset('assets/lottie/scan.json'), ), ), SizedBox( height: 10.h, ), Padding( padding: const EdgeInsets.all(8.0), child: PinFieldAutoFill( controller: sc.otpController, decoration: UnderlineDecoration( textStyle: Theme.of(context).textTheme.headline2, colorBuilder: FixedColorBuilder( Color.fromRGBO(150, 167, 175, 1), ), ), currentCode: sc.otpController.text, onCodeSubmitted: (code) {}, onCodeChanged: (code) { if (code!.length == 6) { FocusScope.of(context).unfocus(); sc.otpController.text = code; sc.isLoading.value = true; PhoneAuthCredential phoneAuthCredential = PhoneAuthProvider.credential( verificationId: sc.verificationId.value, smsCode: sc.otpController.text); sc.signInWithPhoneAuthCredential( phoneAuthCredential, context); //FocusScope.of(context).requestFocus(FocusNode()); } }, ), ), SizedBox( height: 0.1.sh, ), !sc.isLoading.value ? CustomButton( buttonText: 'Verify', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), onTap: () { Navigator.of(context) .pushNamed(PermissionsPage.routeName); }, ) : const Center( child: CircularProgressIndicator(), ), ], )), ), ); } Row buildTimer(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ //Text("This code will expired in "), TweenAnimationBuilder( tween: Tween(begin: 45.0, end: 0.0), duration: const Duration(seconds: 45), builder: (_, dynamic value, child) => Text( "00:${value.toInt()}", style: Theme.of(context).textTheme.headline2, ), onEnd: () {}, ), ], ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/map/map.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:sort_it/src/screens/map/components/card.dart'; import 'components/header.dart'; class MapPreview extends StatelessWidget { static String routeName = '/map'; const MapPreview({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/map.jpg'), fit: BoxFit.fill), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 35.w, vertical: 30.h, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Header(), CustomCard(), ], ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/map
mirrored_repositories/sort_it/lib/src/screens/map/components/card.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class CustomCard extends StatelessWidget { const CustomCard({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( width: double.infinity, height: 150.h, padding: EdgeInsets.symmetric( horizontal: 35.w, vertical: 15.h, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Color.fromRGBO(0, 0, 0, 0.20000000298023224), offset: Offset(0, 10), blurRadius: 20) ], color: Color.fromRGBO(31, 46, 53, 1), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Waste disposal site', style: Theme.of(context).textTheme.headline5, ), Text( '📍 25, Birnin Kebbi Cres, Garki,\nAbuja • 2km', softWrap: true, style: Theme.of(context).textTheme.headline3, ), ], ), Container( width: 45, height: 45, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/Oval.png'), fit: BoxFit.fitWidth), borderRadius: BorderRadius.all(Radius.elliptical(45, 45)), ), ), ], ), Text( 'Routing', style: Theme.of(context).textTheme.headline4, ), Container( width: 290, height: 45, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Color.fromRGBO(0, 0, 0, 0.16), offset: Offset(0, 5), blurRadius: 10) ], color: Color(0xffFF575F), ), child: Center( child: Text( 'Stop', textAlign: TextAlign.center, style: Theme.of(context) .textTheme .headline3! .copyWith(color: Colors.white), ), ), ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/map
mirrored_repositories/sort_it/lib/src/screens/map/components/header.dart
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class Header extends StatelessWidget { const Header({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.bars, color: Colors.white, ), ), IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.cog, color: Colors.white, ), ), ], ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/choice/choice.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:lottie/lottie.dart'; import 'package:sort_it/components/custom_button.dart'; import 'package:sort_it/src/screens/complete/complete_profile.dart'; class Choice extends StatelessWidget { static String routeName = '/choice'; const Choice({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 0.1.sh, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( 'I am here to', style: Theme.of(context).textTheme.headline1, ), Container( width: 0.3.sh, height: 0.3.sh, child: Lottie.asset('assets/lottie/garbage.json'), ), Text( 'Please mention your use type', textAlign: TextAlign.center, style: Theme.of(context).textTheme.headline2, ), CustomButton( buttonText: 'Dump garbage', textColor: Colors.white, buttonColor: Color.fromRGBO(63, 223, 158, 1), leading: true, onTap: () { ///Setting the type for further details of user in user db Get.toNamed(CompleteProfile.routeName); }, ), CustomButton( buttonText: 'Collect Garbage', textColor: Color.fromRGBO(63, 223, 158, 1), buttonColor: Color(0xFF286053), leading: false, onTap: () { ///Setting the type for further details of collector in db Get.toNamed(CompleteProfile.routeName); }, ), ], ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/settings/settings.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:get/get_navigation/src/extension_navigation.dart'; import 'package:sort_it/controller/settings_controller.dart'; import 'package:sort_it/src/screens/profile/profile.dart'; import 'package:sort_it/src/screens/settings/components/bottomContainer.dart'; import 'components/body.dart'; class Settings extends StatelessWidget { static String routeName = '/settings'; final SettingsController sc = Get.put(SettingsController()); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric(vertical: 50.w), child: SingleChildScrollView( child: Column( // mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: double.maxFinite, height: 70.h, padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h), decoration: BoxDecoration( color: Color.fromRGBO(48, 68, 78, 1), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( height: 33.h, width: 33.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(50), color: Color(0xFFFFC542), ), child: Center( child: Text( '⭕', style: Theme.of(context).textTheme.headline2, ), ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Alice Smith', style: Theme.of(context).textTheme.headline2!.copyWith( color: Colors.white, ), ), SizedBox( height: 5.h, ), Text( '91 23 456 7890', style: Theme.of(context).textTheme.headline2!.copyWith( color: Colors.white, ), ), SizedBox( height: 5.h, ), Text( 'randommail@gmail.com', style: Theme.of(context).textTheme.headline2, ), ], ), IconButton( onPressed: () { Get.toNamed(Profile.routeName); }, icon: Icon( FontAwesomeIcons.angleRight, color: Color.fromRGBO(150, 167, 175, 1), ), ), ], ), ), SizedBox( height: 15.h, ), Body(), SizedBox( height: 15.h, ), BottomContainer(), ], ), ), ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/settings
mirrored_repositories/sort_it/lib/src/screens/settings/components/bottomContainer.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart'; import 'package:sort_it/constant/constant.dart' as constant; import 'package:sort_it/controller/settings_controller.dart'; class BottomContainer extends StatelessWidget { BottomContainer({Key? key}) : super(key: key); final SettingsController sc = Get.find(); @override Widget build(BuildContext context) { return Container( width: double.maxFinite, height: 160.h, padding: EdgeInsets.symmetric(horizontal: 20.h, vertical: 10.h), decoration: BoxDecoration( color: Color.fromRGBO(48, 68, 78, 1), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 17.h, width: 32.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: constant.colorShadeRed[1], ), child: Icon( FontAwesomeIcons.coins, size: 17.w, color: Colors.white, ), ), Text( 'My Coins', style: Theme.of(context).textTheme.headline5, ), IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.angleRight, color: Color.fromRGBO(150, 167, 175, 1), ), ), ], ), Divider( thickness: 2, color: Color.fromRGBO(150, 167, 175, 1).withOpacity(0.1), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 17.h, width: 32.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: constant.colorShadeYellow[1], ), child: Icon( FontAwesomeIcons.firstOrder, size: 17.w, color: Colors.white, ), ), Text( 'My Orders', style: Theme.of(context).textTheme.headline5, ), IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.angleRight, color: Color.fromRGBO(150, 167, 175, 1), ), ), ], ), Divider( thickness: 2, color: Color.fromRGBO(150, 167, 175, 1).withOpacity(0.1), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 17.h, width: 32.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Color.fromRGBO(61, 213, 152, 1), ), child: Icon( FontAwesomeIcons.store, size: 17.w, color: Colors.white, ), ), Text( 'Store', style: Theme.of(context).textTheme.headline5, ), IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.angleRight, color: Color.fromRGBO(150, 167, 175, 1), ), ), ], ), Divider( thickness: 2, color: Color.fromRGBO(150, 167, 175, 1).withOpacity(0.1), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 17.h, width: 32.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Colors.grey, ), child: Icon( Icons.feedback, size: 17.w, color: Colors.white, ), ), Text( 'Feedback', style: Theme.of(context).textTheme.headline5, ), IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.angleRight, color: Color.fromRGBO(150, 167, 175, 1), ), ), ], ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/settings
mirrored_repositories/sort_it/lib/src/screens/settings/components/body.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart'; import 'package:sort_it/constant/constant.dart' as constant; import 'package:sort_it/controller/settings_controller.dart'; class Body extends StatelessWidget { Body({Key? key}) : super(key: key); final SettingsController sc = Get.find(); @override Widget build(BuildContext context) { return Container( width: double.maxFinite, height: 110.h, padding: EdgeInsets.symmetric(horizontal: 20.h, vertical: 10.h), decoration: BoxDecoration( color: Color.fromRGBO(48, 68, 78, 1), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ InkWell( onTap: sc.changeMode, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Obx( () => Container( height: 17.h, width: 32.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: constant.colorShadeRed[1], ), child: Icon( sc.darkMode.value ? Icons.mode_night_rounded : Icons.wb_sunny_rounded, size: 20.w, color: Colors.white, ), ), ), Text( 'Dark Mode', style: Theme.of(context).textTheme.headline5, ), Obx( () => Container( width: 60.w, height: 18.h, padding: EdgeInsets.symmetric(horizontal: 3, vertical: 1), decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: sc.darkMode.value ? Color.fromRGBO(61, 213, 152, 1) : Color(0xFF2A3C44), ), child: Row( mainAxisAlignment: sc.darkMode.value ? MainAxisAlignment.end : MainAxisAlignment.start, children: [ Container( width: 30.w, height: 14.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: Colors.white, ), ), ], ), ), ), ], ), ), Divider( thickness: 2, color: Color.fromRGBO(150, 167, 175, 1).withOpacity(0.1), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 17.h, width: 32.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: constant.colorShadeYellow[1], ), child: Icon( FontAwesomeIcons.play, size: 17.w, color: Colors.white, ), ), Text( 'Background play', style: Theme.of(context).textTheme.headline5, ), Container( width: 60.w, height: 18.h, padding: EdgeInsets.symmetric(horizontal: 3, vertical: 1), decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: Color(0xFF2A3C44), ), child: Row( children: [ Container( width: 30.w, height: 14.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: Colors.white, ), ), Spacer(), ], ), ), ], ), Divider( thickness: 2, color: Color.fromRGBO(150, 167, 175, 1).withOpacity(0.1), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( height: 17.h, width: 32.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: Color.fromRGBO(61, 213, 152, 1), ), child: Icon( FontAwesomeIcons.language, size: 17.w, color: Colors.white, ), ), Text( 'Change Language', style: Theme.of(context).textTheme.headline5, ), IconButton( onPressed: () {}, icon: Icon( FontAwesomeIcons.angleRight, color: Color.fromRGBO(150, 167, 175, 1), ), ), ], ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/store/store.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_core/src/get_main.dart'; import 'package:get/get_instance/src/extension_instance.dart'; import 'package:sort_it/components/app_bar.dart'; import 'package:sort_it/controller/store_controller.dart'; import 'package:sort_it/src/screens/store/components/banner.dart'; import 'package:sort_it/src/screens/store/components/cartItem.dart'; import 'package:sort_it/src/screens/store/components/categoryItem.dart'; class Store extends StatelessWidget { static String routeName = '/store'; final StoreController s = Get.put(StoreController()); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.6, 0.7), end: Alignment(-0.7, 0.6), colors: [ Color.fromRGBO(34, 52, 60, 1), Color.fromRGBO(31, 46, 53, 1) ]), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: 0.1.sw, vertical: 10.h, ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Flexible( flex: 1, child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.horizontal, itemCount: s.categories.length, itemBuilder: (context, index) { return s.categories[index]; }), ), ), Flexible( flex: 2, child: StoreBanner(), ), Flexible( flex: 2, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ CartItem( tagline: 'Blue Blazer', price: '\$ 45', image: 'assets/images/cart_item2.png', ), CartItem( tagline: 'Red Blazer', price: '\$ 47', image: 'assets/images/cart_item3.png', ), ], ), ), ]), ), )); } }
0
mirrored_repositories/sort_it/lib/src/screens/store
mirrored_repositories/sort_it/lib/src/screens/store/components/cartItem.dart
import 'package:flutter/material.dart'; class CartItem extends StatelessWidget { final String image; final String tagline; final String price; const CartItem( {Key? key, required this.image, required this.tagline, required this.price}) : super(key: key); @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, /// mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Image.asset( image, fit: BoxFit.contain, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 8), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text( tagline, style: Theme.of(context).textTheme.headline4, ), Text( price, style: Theme.of(context).textTheme.headline4, ), ], ), ), ], ); } }
0
mirrored_repositories/sort_it/lib/src/screens/store
mirrored_repositories/sort_it/lib/src/screens/store/components/categoryItem.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class CategoryItem extends StatelessWidget { final String subtitle; final String icon; final bool isselected; const CategoryItem( {Key? key, required this.subtitle, required this.icon, required this.isselected}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: Container( width: 81, height: 146, padding: EdgeInsets.symmetric(vertical: 5.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40.5), boxShadow: [ BoxShadow( color: Color.fromRGBO(25, 40, 47, 1), offset: Offset(0, 1), blurRadius: 14) ], color: isselected ? Color.fromRGBO(255, 86, 94, 1) : Color(0xFF30444E), ), child: Column( children: [ Container( width: 66, height: 66, decoration: BoxDecoration( color: isselected ? Color.fromRGBO(255, 86, 94, 1) : Color(0xFF30444E), borderRadius: BorderRadius.circular(50), border: Border.all( color: isselected ? Color.fromRGBO(255, 255, 255, 1) : Color(0xFF475E69), ), ), child: Center( child: Text( icon, style: Theme.of(context).textTheme.headline1, )), ), SizedBox( height: 10.h, ), Text( subtitle, style: isselected ? Theme.of(context).textTheme.headline5 : Theme.of(context).textTheme.headline4, ), ], )), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/store
mirrored_repositories/sort_it/lib/src/screens/store/components/banner.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class StoreBanner extends StatelessWidget { const StoreBanner({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( height: 0.25.sh, width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), image: DecorationImage( image: AssetImage( 'assets/images/cart_banner.png', ), fit: BoxFit.fill, ), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Belt suit blazer', style: Theme.of(context).textTheme.headline4!.copyWith( fontSize: 24.w, ), ), SizedBox( height: 10.h, ), Text( '🪙 120/-', textAlign: TextAlign.center, style: Theme.of(context) .textTheme .headline1! .copyWith(fontSize: 25.w, color: Colors.black), ), ], ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens
mirrored_repositories/sort_it/lib/src/screens/welcome/welcome.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:sort_it/src/screens/sign_up/sign_up.dart'; import 'package:sort_it/src/screens/welcome/components/welcome_splash.dart'; import 'package:sort_it/controller/welcome_controller.dart'; class Welcome extends StatelessWidget { static String routeName = '/welcome'; Welcome({Key? key}) : super(key: key); WelcomeController _welcomeController = Get.put(WelcomeController()); @override Widget build(BuildContext context) { return Scaffold( body: Container( padding: const EdgeInsets.all(10), height: double.infinity, width: double.infinity, color: Color(0xff1F2E35), child: Column( children: [ Expanded( child: PageView.builder( controller: _welcomeController.pc, onPageChanged: (index) { _welcomeController.updateIndex(index); }, itemCount: _welcomeController.posters.length, itemBuilder: (context, index) { return WelcomeSplash( welcomePoster: _welcomeController.posters[index]); }, ), ), SizedBox(height: 25.h), GetBuilder<WelcomeController>( builder: (controller) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ ...controller.posters.map((poster) { return AnimatedContainer( margin: const EdgeInsets.symmetric(horizontal: 5), duration: Duration(milliseconds: 350), height: 10, width: poster.index == controller.selectedIndex ? 20 : 10, decoration: BoxDecoration( color: poster.index == controller.selectedIndex ? Color(0xff66C34F) : Color(0xff999999), borderRadius: BorderRadius.circular(15), ), ); }).toList(), ], ); }, ), SizedBox(height: 10.h), TextButton( onPressed: _welcomeController.skipPage, child: Text( 'Skip', style: TextStyle( fontSize: 18, color: Color(0xffBCDDB4), fontFamily: 'abzr', ), ), ), SizedBox(height: 20.h), ], ), ), ); } }
0
mirrored_repositories/sort_it/lib/src/screens/welcome
mirrored_repositories/sort_it/lib/src/screens/welcome/components/welcome_splash.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:sort_it/model/welcome_model.dart'; class WelcomeSplash extends StatelessWidget { WelcomeSplash({Key? key, required this.welcomePoster}) : super(key: key); WelcomePoster welcomePoster; @override Widget build(BuildContext context) { return Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Image.asset( welcomePoster.image, fit: BoxFit.contain, ), ), Text( welcomePoster.heading, style: Theme.of(context).textTheme.headline1!.copyWith( fontSize: 32.w, color: Color(0xffBCDDB4), ), ), const SizedBox(height: 10), Text( welcomePoster.caption, style: Theme.of(context).textTheme.headline2, textAlign: TextAlign.center, ), const SizedBox(height: 30), ], ); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/constant/constant.dart
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; final String appDesc = 'Nothing is waste, but it becomes one when it is in the wrong place ,' 'but who has the time to sort it and put it at its right place?' 'That\'s what •Sort lt- app does! puts your waste in the right place.' 'Not every waste is landfill , take a step towards greener earth.'; final TextStyle headline1 = TextStyle( color: Color.fromRGBO(255, 255, 255, 1), fontFamily: 'abzi', fontSize: 42.w, letterSpacing: 0, fontWeight: FontWeight.normal, height: 1); final TextStyle headline2 = TextStyle( color: Color.fromRGBO(150, 167, 175, 1), fontFamily: 'abzr', fontSize: 24.w, letterSpacing: 0, fontWeight: FontWeight.normal, height: 1); final TextStyle headline3 = TextStyle( color: Color.fromRGBO(150, 167, 175, 1), fontFamily: 'abzi', fontSize: 14.w, letterSpacing: 0, fontWeight: FontWeight.normal, height: 1.7); final TextStyle headline4 = TextStyle( color: Color.fromRGBO(150, 167, 175, 1), fontFamily: 'abzr', fontSize: 18.w, letterSpacing: 0, fontWeight: FontWeight.normal, height: 1); final TextStyle headline5 = TextStyle( color: Color.fromRGBO(255, 255, 255, 1), fontFamily: 'abzr', fontSize: 18.w, letterSpacing: 0, fontWeight: FontWeight.normal, height: 1.4); final List<Color> colorShadeGreen = [ Color(0xffe4efee), Color(0xffafd0cb), Color(0xff79b0a8), Color(0xff4f867e), Color(0xff2f504b), Color(0xff101b19), ]; final List<Color> colorShadeRed = [ Color(0xffffaaae), Color(0xffFF575F), Color(0xff550004), ]; final List<Color> colorShadeYellow = [ Color(0xffffe5aa), Color(0xffffb100), Color(0xff553b00), ];
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/controller/editprofile_controller.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:get/get_rx/src/rx_types/rx_types.dart'; import 'package:get/get_state_manager/src/simple/get_controllers.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; import 'dart:io'; class EditProfileController extends GetxController { //------------------VARIABLES-------------// final FirebaseAuth _auth = FirebaseAuth.instance; var errormessage = 'An error occured please check your credentials!'; String userEmail = ''; String userName = ''; String userPassword = ''; var isLogin = false; bool showPassword = false; final formKey = GlobalKey<FormState>(); Rx<File>? pickedImage; final TextEditingController nameController = TextEditingController(); final TextEditingController emailController = TextEditingController(); final TextEditingController passController = TextEditingController(); final TextEditingController phoneController = TextEditingController(); final TextEditingController addController = TextEditingController(); ///Set all the controller values for edit profile controller void setFields() {} void _imgFromCamera() async { final imageFile = await ImagePicker().pickImage( source: ImageSource.camera, imageQuality: 80, maxHeight: 120, maxWidth: 120, ); pickedImage!.value = File(imageFile!.path); } void _imgFromGallery() async { final image = await ImagePicker().pickImage( source: ImageSource.gallery, imageQuality: 80, maxHeight: 120, maxWidth: 120, ); pickedImage!.value = File(image!.path); } Future<bool> trySubmit(BuildContext context) async { bool _isValid = formKey.currentState!.validate(); FocusScope.of(context).unfocus(); // if (pickedImage == null ) { // ScaffoldMessenger.of(context).showSnackBar( // SnackBar( // content: Text('Please select an image'), // backgroundColor: Theme.of(context).errorColor, // ), // ); // return false; // } if (_isValid) { formKey.currentState!.save(); return submitAuthForm( userEmail.trim(), userPassword.trim(), userName.trim(), isLogin, pickedImage!.value, context, ); } return false; } Future<bool> submitAuthForm( String email, String password, String username, bool isLogin, File? image, BuildContext ctx, ) async { User? currentuser = _auth.currentUser; try { final ref = FirebaseStorage.instance .ref() .child('users') .child(currentuser!.uid + '.jpg'); await ref.putFile(image!); final url = await ref.getDownloadURL(); // await FirebaseFirestore.instance // .collection('users') // .doc(currentuser.uid) // .set({ // 'name': username, // 'email': email, // 'image_url': url, // }); Fluttertoast.showToast(msg: 'Welcome $username!'); return true; } catch (err) { errormessage = err.toString(); ScaffoldMessenger.of(ctx).showSnackBar( SnackBar( content: Text(errormessage), action: SnackBarAction( onPressed: () {}, label: 'undo', ), backgroundColor: Colors.black, ), ); return false; } } void showPicker(context) { showModalBottomSheet( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(24), ), context: context, builder: (BuildContext bc) { return SafeArea( child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(24), topRight: Radius.circular(24), ), color: Color(0xFF30444E), ), child: new Wrap( children: <Widget>[ new ListTile( leading: new Icon( Icons.photo_library, color: Color.fromRGBO(63, 223, 158, 1), ), title: new Text( 'Photo Library', style: Theme.of(context).textTheme.headline2, ), onTap: () { //_imgFromGallery(); Navigator.of(context).pop(); }), new ListTile( leading: new Icon( Icons.photo_camera, color: Color.fromRGBO(63, 223, 158, 1), ), title: new Text( 'Camera', style: Theme.of(context).textTheme.headline2, ), onTap: () { // _imgFromCamera(); Navigator.of(context).pop(); }, ), ], ), ), ); }); } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/controller/welcome_controller.dart
import 'package:get/get.dart'; import 'package:flutter/material.dart'; import 'package:sort_it/model/welcome_model.dart'; import 'package:sort_it/src/screens/sign_up/sign_up.dart'; class WelcomeController extends GetxController { ///-----------Page Controller PC ------------------/// PageController pc = PageController(); List<WelcomePoster> posters = [ WelcomePoster( image: 'assets/images/splash/1 (5).png', heading: 'TRUST', caption: 'We have trained staff and ISO Marked machines for accurate results', index: 0), WelcomePoster( image: 'assets/images/splash/1 (2).png', heading: 'TIME CONVINIENT', caption: 'You\'re busy? Don\'t worry! We would come to you as per your time convenience', index: 1), WelcomePoster( image: 'assets/images/splash/1 (4).png', heading: 'EARN', caption: 'Give away your waste and earn on top of it!', index: 2), WelcomePoster( image: 'assets/images/splash/1 (3).png', heading: 'CATEGORIES', caption: 'Choose from Extensive range of categories we have to offer', index: 3), WelcomePoster( image: 'assets/images/splash/1 (6).png', heading: 'REGULATED PRICES', caption: 'We offer Accurate Market Prices', index: 4), WelcomePoster( image: 'assets/images/splash/1 (1).png', heading: 'RECYCLE', caption: 'We strongly believe nothing is waste, Everything has a right place', index: 5), ]; int selectedIndex = 0; void updateIndex(int val) { selectedIndex = val; update(); } void skipPage() { Get.offAllNamed(SignUp.routeName); } ///----------------Code For auto animation from the start of the screen-----------------/// ///---------------------May not be useful in some cases , so in hold -------------------/// // @override // void initState() { // _welcomeController.animateSlider(0, context); // super.initState(); // } // // void animateSlider(int nextPage, BuildContext context) { // Future.delayed(Duration(seconds: 1)).then((_) { // if (nextPage == posters.length) { // skipPage(); // } // if (pc.hasClients) // pc // .animateToPage(nextPage, // duration: Duration(milliseconds: 800), curve: Curves.easeOut) // .then((_) => animateSlider(nextPage + 1, context)); // }); // } }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/controller/store_controller.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:sort_it/src/screens/store/components/categoryItem.dart'; class StoreController extends GetxController { final List<CategoryItem> categories = [ CategoryItem(subtitle: 'Hot', icon: '🔥', isselected: true), CategoryItem(subtitle: 'Woman', icon: '👚', isselected: false), CategoryItem(subtitle: 'Man', icon: '👕', isselected: false), CategoryItem(subtitle: 'Shoes', icon: '👟', isselected: false), ]; }
0
mirrored_repositories/sort_it/lib
mirrored_repositories/sort_it/lib/controller/home_controller.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; class HomeController extends GetxController { //-------------------VARIABLES-----------------------------// ///Purpose of this global key is nothing other than opening drawer final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(); RxInt selectedIndex = 0.obs; final PageController pageController = PageController(); void onTappedBar(int value) { selectedIndex.value = value; pageController.animateToPage(selectedIndex.value, duration: Duration(milliseconds: 500), curve: Curves.easeInOut); } RxBool isOpened = false.obs; void changeOpenState({required bool newval}) { isOpened.value = newval; } }
0