我已将 geoJson 源加载到我的 mapView 中。我的 .net 中有一个搜索栏activity。所以我的计划是,我想使用添加到地图的源searchBar中的要素类型来填充我的建议。geoJson我想从onMapStyleLoaded方法中做到这一点。
那么,有没有一种方法可以获取所有geoJson属性(例如“名称”)的详细信息,并将所有属性添加到arrayList加载地图时?
@Override
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
SearchActivity.this.mapboxMap = mapboxMap;
mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> {
mapboxMap.addOnMapClickListener(SearchActivity.this);
addGeoJsonSourceToMap(style);
// Create FillLayer with GeoJSON source and add the FillLayer to the map
style.addLayer(new FillLayer(geoJsonLayerId, geoJsonSourceId)
.withProperties(fillOpacity(0.5f)));
GeoJsonSource source = style.getSourceAs(geoJsonSourceId);
if (source != null){
List<Feature> features = source.querySourceFeatures(Expression.get("name"));
//I want to all the features of my geoJson source so I can pass …Run Code Online (Sandbox Code Playgroud) 我已经Firebase Cloud Messaging在我的扑动应用程序中实现了。一切正常,但我想将所有消息列表存储在本地shared preferences并在另一个屏幕中检索它们。onMessage 我的所有逻辑都不能很好地工作,因为调用函数时我无法保存消息。
推送通知服务
class PushNotificationService {
final FirebaseMessaging _fcm = FirebaseMessaging();
List<String> titles;
List<String> msgs;
Future initialise() async {
notiList = List<NotiMessage>();
if (Platform.isIOS) {
// request permissions if we're on android
_fcm.requestNotificationPermissions(IosNotificationSettings());
_fcm.configure();
// For testing purposes print the Firebase Messaging token
String token = await _fcm.getToken();
print("FirebaseMessaging token: $token");
} else{
String token = await _fcm.getToken();
print("FirebaseMessaging token: $token");
}
_fcm.configure(
// Called when the app is in the foreground …Run Code Online (Sandbox Code Playgroud) 如何使 a 的ChipGroup行为类似于radioButton在更改背景颜色时一次可以选择一个项目。
我看到了类似这样的链接,但它对我没有帮助,因为我使用 alayoutInflater来显示我的芯片项目。
firebaseFirestore.collection("Categories").addSnapshotListener((queryDocumentSnapshots, e) -> {
for (DocumentChange doc: queryDocumentSnapshots.getDocumentChanges()){
if (doc.getType() == DocumentChange.Type.ADDED){
Categories categories = doc.getDocument().toObject(Categories.class);
post_list.add(categories);
Chip chip = (Chip) getLayoutInflater().inflate(R.layout.chip_item_layout, chipGroup, false);
chip.setText(categories.getTitle());
chipGroup.addView(chip);
chipGroup.setOnCheckedChangeListener((chipGroup, id) -> {
Chip chip2 = ((Chip) chipGroup.getChildAt(chipGroup.getCheckedChipId()));
if (chip2 != null) {
for (int i = 0; i < chipGroup.getChildCount(); ++i) {
chipGroup.getChildAt(i).setClickable(true);
chip2.setChipBackgroundColorResource(R.color.customOrange);
}
chip2.setClickable(false);
}
});
}
}
});
Run Code Online (Sandbox Code Playgroud) java android android-layout android-chips material-components-android
Text我正在尝试为我的in中设置自定义字体Flutter。我已经尝试了我所知道的一切,但没有成功。这是一个错误还是什么?
flutter:
uses-material-design: true
assets:
- assets/images/onboarding1.png
- assets/images/onboarding2.png
- assets/images/onboarding3.png
fonts:
- family: Gilroy
fonts:
- asset: assets/fonts/gilroy_extrabold.otf
Run Code Online (Sandbox Code Playgroud)
飞镖文件
SizedBox(height: 30.0),
Text(
'Connect with Mentors',
style: TextStyle(
fontFamily: 'Gilroy',
fontSize: 35.0,
),
),
Run Code Online (Sandbox Code Playgroud) 我正在login我的应用程序中集成,其中在发出请求时应该出现一个循环进度指示器。我不知道为什么progressBar总是出现在顶部而不是中心。请帮忙。
FadeAnimation(
1.8,
Center(
child: Container(
height: double.infinity,
child: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.symmetric(
horizontal: 40.0,
vertical: 120.0,
),
child: _isLoading
? Center(child: CircularProgressIndicator())
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Sign In',
style: TextStyle(
color: Colors.white,
fontFamily: 'OpenSans',
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 30.0),
_buildEmailTF(),
SizedBox(
height: 30.0,
),
_buildPasswordTF(),
_buildForgotPasswordBtn(),
_buildRememberMeCheckbox(),
_buildLoginBtn(),
_buildSignInWithText(),
_buildSocialBtnRow(),
_buildSignupBtn(),
],
),
),
)),
)
Run Code Online (Sandbox Code Playgroud) 假设我们将名称设置为“Ben Bright”。我想输出给用户“BB”,每个单词的第一个字符。我试过这个split()方法,但我用飞镖没能做到。
String getInitials(bank_account_name) {
List<String> names = bank_account_name.split(" ");
String initials;
for (var i = 0; i < names.length; i++) {
initials = '${names[i]}';
}
return initials;
}
Run Code Online (Sandbox Code Playgroud) 我需要在我的应用程序上运行一个计时器实例,以便我可以在需要时取消并重新初始化它。但是,调用该操作后计时器不会取消.cancel()。仅当我从默认构造函数调用它时它才有效,但我想要一个可以随时取消的全局计时器;
Timer timer;
timer = Timer.periodic(Duration(seconds: 10), (Timer t) async {
//cancelling timer only works here e.g (t.cancel)
print("loop operation");
});
timer.cancel(); // calling this method outside the constructor don't work.
Run Code Online (Sandbox Code Playgroud) flutter ×4
dart ×3
android ×2
custom-font ×1
java ×1
material-components-android ×1
progress-bar ×1