This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| class RankProgressBar extends StatelessWidget { | |
| final double progress; // From 0.0 → 1.0 | |
| final int currentRank; // e.g., 7 | |
| final List<int> milestones; // e.g., [7, 6, 5, 4, 3, 2, 1] | |
| const RankProgressBar({ | |
| super.key, | |
| required this.progress, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyApp extends StatelessWidget { | |
| const MyApp({super.key}); | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { | |
| return StreamBuilder( | |
| stream: Connectivity().onConnectivityChanged, | |
| builder: (context, AsyncSnapshot<ConnectivityResult> snapshot) { | |
| return snapshot.data == ConnectivityResult.mobile || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static Widget buildSignupSigninBtn(var quetion, var pageName, Function function) { | |
| return Padding(padding: EdgeInsets.only(bottom: 0,top: 5),child: GestureDetector( | |
| onTap: () { | |
| function(); | |
| }, | |
| child: RichText( | |
| text: TextSpan( | |
| children: [ | |
| TextSpan( | |
| text: quetion, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MaterialButton( | |
| shape: RoundedRectangleBorder( | |
| borderRadius: BorderRadius.circular(40), | |
| ), | |
| color: Colors.white, | |
| child: Text('Simple Pop Up'), | |
| onPressed: () async { | |
| await animated_dialog_box.showCustomAlertBox( | |
| // You can change the animation which u=you want to use like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future googleLogin() async { | |
| final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); | |
| final GoogleSignInAuthentication googleSignInAuthentication = | |
| await googleSignInAccount.authentication; | |
| final AuthCredential credential = GoogleAuthProvider.getCredential( | |
| accessToken: googleSignInAuthentication.accessToken, | |
| idToken: googleSignInAuthentication.idToken, | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void _twitterLogin() async { | |
| String newMessage; | |
| final TwitterLoginResult result = await twitterLogin.authorize(); | |
| switch (result.status) { | |
| case TwitterLoginStatus.loggedIn: | |
| newMessage = 'Logged in! username: ${result.session.username}'; | |
| break; | |
| case TwitterLoginStatus.cancelledByUser: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future insertData(var username, var useremail, var userimage, var userauth, | |
| var usersource) async { | |
| var url = "YOUR_INSERT_DATA_API"; | |
| final response = await http.post(url, body: { | |
| "username": username, | |
| "useremail": useremail, | |
| "userimage": userimage, | |
| "userauth": userauth, | |
| "usersource": usersource | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case FacebookLoginStatus.loggedIn: | |
| final FacebookAccessToken accessToken = result.accessToken; | |
| var response = await http.get( | |
| 'https://graph.facebook.com/v2.12/me?fields=name,first_name,last_name,email,picture&access_token=${result.accessToken.token}'); | |
| var responseData = json.decode(response.body); | |
| insertData(responseData['name'],responseData['email'],responseData['picture']['data']['url'],responseData['id'],"Facebook"); | |
| break; |
NewerOlder