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 CreateTransactionPin extends StatefulWidget { | |
| const CreateTransactionPin({Key? key}) : super(key: key); | |
| @override | |
| State<CreateTransactionPin> createState() => _CreateTransactionPinState(); | |
| } | |
| class _CreateTransactionPinState extends State<CreateTransactionPin> { | |
| String field1 = ''; | |
| String field2 = ''; |
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'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({Key? key}) : super(key: key); | |
| @override |
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 WeatherModel { | |
| final double latitude; | |
| final double longitude; | |
| WeatherModel({ | |
| required this.latitude, | |
| required this.longitude, | |
| }); | |
| } | |
| class WeatherResponseModel { |
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
| final weatherServiceProvider = Provider((ref) => WeatherServiceImpl()); | |
| abstract class WeatherService { | |
| Future getWeather(WeatherModel model); | |
| } | |
| class WeatherServiceImpl extends WeatherService { | |
| final _client = Client(); | |
| const baseUrl = "https://api.openweathermap.org/data/"; | |
| const version = '2.5/'; |
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_riverpod/flutter_riverpod.dart'; | |
| import 'package:location/location.dart'; | |
| final landingViewProvider = | |
| StateNotifierProvider<LandingViewModel, bool>((ref) => LandingViewModel()); | |
| class LandingViewModel extends StateNotifier<bool> { | |
| LandingViewModel() : super(false); | |
| Future<bool> getUserLocation() async { |
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 LandingView extends StatelessWidget { | |
| const LandingView({Key? key}) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Consumer(builder: (context, ref, child) { | |
| final storage = ref.read(storageProvider); | |
| return Scaffold( | |
| body: SafeArea( | |
| minimum: const EdgeInsets.all(16), |
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
| final homeViewModelProvider = Provider((ref) => HomeViewModel()); | |
| class HomeViewModel { | |
| Future<WeatherResponseModel> getWeather(WidgetRef ref) async { | |
| try { | |
| final location = await Location.instance.getLocation(); | |
| final model = WeatherModel( | |
| latitude: location.latitude!, longitude: location.longitude!); | |
| print(model.latitude); |
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
| final homeViewFutureProvider = FutureProvider.family( | |
| (ref, WidgetRef _ref) async => | |
| ref.watch(homeViewModelProvider).getWeather(_ref)); | |
| class HomeView extends StatelessWidget { | |
| const HomeView({Key? key}) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { |
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'; | |
| import 'package:page_transition/page_transition.dart'; | |
| class HomeView extends StatefulWidget { | |
| const HomeView({super.key}); | |
| @override | |
| State<HomeView> createState() => _HomeViewState(); | |
| } |
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 Home extends StatefulWidget { | |
| const Home({super.key}); | |
| @override | |
| State<Home> createState() => _HomeState(); | |
| } | |
| class _HomeState extends State<Home> { | |
| @override |
OlderNewer