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/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
void main() { | |
runApp(ProviderScope(child: DarkModeExample())); | |
} | |
class DarkModeExample extends ConsumerWidget { | |
// This widget is the root of your application. |
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'; | |
void main() { | |
runApp(MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: FormValidationExample(), | |
)); | |
} | |
class FormValidationExample extends StatelessWidget with InputValidationMixin { |
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
main() { | |
Widget _loadLoginPage() => MaterialApp( | |
home: Scaffold( | |
body: LoginPage(), | |
), | |
); | |
testWidgets("Find one Image in Login Screen", | |
(WidgetTester widgetTester) async { | |
await widgetTester.pumpWidget(_loadLoginPage()); |
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:email_validator/email_validator.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
import 'package:fluttertoast/fluttertoast.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<fragment | |
android:id="@+id/myNavHostFragment" |
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 PostsOverviewFragment : Fragment() { | |
lateinit var binding: PostsOverviewFragmentBinding | |
private val postViewModel: PostsOverviewViewModel by lazy{ | |
ViewModelProviders.of(this).get(PostsOverviewViewModel::class.java) | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, container: ViewGroup?, |
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 PostsOverviewViewModel : ViewModel() { | |
private val _posts = MutableLiveData<List<Post>>() | |
val post: LiveData<List<Post>> | |
get() = _posts | |
init { | |
getPosts() | |
} |
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 PostListAdapter: RecyclerView.Adapter<PostListAdapter.ViewHolder>(){ | |
var data = listOf<Post>() | |
set(value) { | |
field = value | |
notifyDataSetChanged() | |
} | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | |
return ViewHolder.from(parent) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<data> | |
<variable | |
name="viewModel" | |
type="posts_overview.PostsOverviewViewModel" /> | |
</data> |
NewerOlder