View flutter_infinite_scroll_main_3.dart
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
Widget getBody() { | |
if (_photos.isEmpty) { | |
if (_loading) { | |
return Center( | |
child: Padding( | |
padding: const EdgeInsets.all(8), | |
child: CircularProgressIndicator(), | |
)); | |
} else if (_error) { | |
return Center( |
View flutter_infinite_scroll_main_2.dart
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
Future<void> fetchPhotos() async { | |
try { | |
final response = await http.get( | |
"https://jsonplaceholder.typicode.com/photos?_page=$_pageNumber"); | |
List<Photo> fetchedPhotos = Photo.parseList(json.decode(response.body)); | |
setState(() { | |
_hasMore = fetchedPhotos.length == _defaultPhotosPerPageCount; | |
_loading = false; | |
_pageNumber = _pageNumber + 1; | |
_photos.addAll(fetchedPhotos); |
View flutter_infinite_scroll_main_1.dart
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 PhotosListScreen extends StatefulWidget { | |
PhotosListScreen({Key key}) : super(key: key); | |
@override | |
_PhotosListScreenState createState() => _PhotosListScreenState(); | |
} | |
class _PhotosListScreenState extends State<PhotosListScreen> { | |
bool _hasMore; | |
int _pageNumber; | |
bool _error; | |
bool _loading; |
View main.dart
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
//........................................... | |
body: FutureBuilder<String>( | |
future: fetchJoke(), | |
builder: (BuildContext context, AsyncSnapshot<String> snapshot) { | |
switch (snapshot.connectionState) { | |
case ConnectionState.none: | |
case ConnectionState.active: | |
case ConnectionState.waiting: | |
return Center(child: CircularProgressIndicator()); | |
case ConnectionState.done: |
View main.dart
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
//........................................... | |
Future<String> fetchJoke() async { | |
var url = "https://api.chucknorris.io/jokes/random?category=dev"; | |
var response = await http.get(url); | |
if (response.statusCode == 200) { | |
var jsonResponse = convert.jsonDecode(response.body); | |
return jsonResponse['value']; | |
} else { | |
return ("Unexpected error occurred."); | |
} |
View main.dart
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_web/material.dart'; | |
void main() => runApp(App()); | |
class App extends MaterialApp { | |
@override | |
String get title => "Chuck Norris Jokes"; | |
@override | |
ThemeData get theme => ThemeData(primarySwatch: Colors.blue); | |
@override |
View BaseActivity.java
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
public abstract class BaseActivity extends AppCompatActivity { | |
private AlertDialog dialog; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
connectToFirebase(); | |
} |
View UnderMaintenance.java
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
public class UnderMaintenance { | |
public boolean is_under_maintenance; | |
public String under_maintenance_message; | |
public UnderMaintenance() { | |
} | |
} |
View vue_axios_example.html
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
<!DOCTYPE html> | |
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Vue.js | Making API calls using Axios</title> | |
</head> | |
<body style="text-align: center"> | |
<div id="app" style="display: inline-block;margin-top: 100px"> | |
<img v-bind:src="avatar" alt=""> | |
<h1 style="margin-bottom: 0">{{name}}</h1> |
View base.dart
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
abstract class BaseStatefulWidget extends StatefulWidget { | |
String getTitle(); | |
Widget body(AsyncSnapshot snapshot); | |
Future future(); | |
@override | |
State<StatefulWidget> createState() => BaseState(getTitle()); | |
} |
NewerOlder