Skip to content

Instantly share code, notes, and snippets.

View austinevick's full-sized avatar
🎯
Focusing

Augustine Victor austinevick

🎯
Focusing
View GitHub Profile
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 = '';
@austinevick
austinevick / search_and_pop_result.dart
Created August 19, 2022 00:20
A code snippet to search through a list and return result from another page.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
class WeatherModel {
final double latitude;
final double longitude;
WeatherModel({
required this.latitude,
required this.longitude,
});
}
class WeatherResponseModel {
@austinevick
austinevick / .dart
Last active September 8, 2022 11:58
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/';
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 {
@austinevick
austinevick / .dart
Last active September 8, 2022 12:59
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),
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);
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) {
@austinevick
austinevick / .dart
Created April 26, 2023 17:09
WhatsApp floating header in flutter
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();
}
@austinevick
austinevick / .dart
Created July 11, 2023 16:33
Calculate percentage and progress
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override