This file contains 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
@Composable | |
fun FlowRow( | |
horizontalGap: Dp = 0.dp, | |
verticalGap: Dp = 0.dp, | |
alignment: Alignment.Horizontal = Alignment.Start, | |
content: @Composable () -> Unit, | |
) = Layout(content = content) { measurables, constraints -> | |
val horizontalGapPx = horizontalGap.toPx().roundToInt() | |
val verticalGapPx = verticalGap.toPx().roundToInt() |
This file contains 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 SearchAnchorDemo extends StatefulWidget { | |
const SearchAnchorDemo({super.key}); | |
@override | |
State<SearchAnchorDemo> createState() => _SearchAnchorDemoState(); | |
} | |
class _SearchAnchorDemoState extends State<SearchAnchorDemo> { | |
List<String> fruits = [ |
This file contains 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/services.dart'; | |
class CustomRangeTextInputFormatter extends TextInputFormatter { | |
final double min; | |
final double max; | |
CustomRangeTextInputFormatter({required this.min, required this.max}); | |
@override | |
TextEditingValue formatEditUpdate( | |
TextEditingValue oldValue, |
This file contains 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 ScrollToTopWidgetWrapper extends StatefulWidget { | |
final Widget child; | |
const ScrollToTopWidgetWrapper({super.key, required this.child}); | |
@override | |
State<ScrollToTopWidgetWrapper> createState() => | |
_ScrollToTopWidgetWrapperState(); | |
} | |
class _ScrollToTopWidgetWrapperState extends State<ScrollToTopWidgetWrapper> { |
This file contains 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 'dart:convert'; | |
import 'package:http/http.dart'; //Add http package to pubspec.yaml | |
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; //Add infinite_scroll_pagination package to pubspec.yaml | |
class HomePage extends StatefulWidget { | |
const HomePage({Key? key}) : super(key: key); | |
@override | |
State<HomePage> createState() => _HomePageState(); | |
} |
This file contains 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 |
This file contains 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 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 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 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), |
NewerOlder