Skip to content

Instantly share code, notes, and snippets.

@austinevick
Last active September 8, 2022 12:59
Show Gist options
  • Save austinevick/3fa9b855c437e5aec01932342dc35cea to your computer and use it in GitHub Desktop.
Save austinevick/3fa9b855c437e5aec01932342dc35cea to your computer and use it in GitHub Desktop.
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),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
Image.asset('images/img1.png', height: 200),
const SizedBox(height: 50),
const Text('Weather forcast',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w800,
)),
const SizedBox(height: 8),
const Text('Discover the weather in your city.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
color: Colors.grey,
fontWeight: FontWeight.w800,
)),
const Spacer(),
CustomButton(
onPressed: () async {
return ref
.read(landingViewProvider.notifier)
.getUserLocation()
.then((value) {
if (value) {
storage.savePageValue(value);
Navigator.of(context).push(MaterialPageRoute(
builder: (ctx) => const HomeView()));
}
});
},
color: const Color(0xff4eda83),
width: double.infinity,
radius: 80,
text: 'Get Started',
child: ButtonLoader(
isLoading: ref.watch(landingViewProvider),
text: 'Get Started'),
),
const Spacer(),
],
),
),
);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment